最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - How to hide CSS by default and show on button press

programmeradmin2浏览0评论

I have the Elementor Pro page builder plugin installed and I want to setup a expanding column so when a button is pressed it expands more Elementor sections.

I'm pretty certain this can be done with jQuery but can't get it to work properly.

I got the button to work using this code

jQuery( document ).on( 'click',  '#MY_BTN', function( event ) {
   event.preventDefault();
   // Show/Hide the widget
   jQuery( '#MY_WIDGET' ).toggle();
});

but I couldn't get the section to hide by default, how do I achieve this?

Many thanks

Thomas

I have the Elementor Pro page builder plugin installed and I want to setup a expanding column so when a button is pressed it expands more Elementor sections.

I'm pretty certain this can be done with jQuery but can't get it to work properly.

I got the button to work using this code

jQuery( document ).on( 'click',  '#MY_BTN', function( event ) {
   event.preventDefault();
   // Show/Hide the widget
   jQuery( '#MY_WIDGET' ).toggle();
});

but I couldn't get the section to hide by default, how do I achieve this?

Many thanks

Thomas

Share Improve this question asked Jun 2, 2019 at 21:46 thomasgardner47thomasgardner47 132 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

You can actually hide it on page load using jQuery ready() method:

$(document).ready(function(){
  $('#MY_WIDGET').hide();
});
发布评论

评论列表(0)

  1. 暂无评论