简体   繁体   中英

Jquery CSS display none

I'm really new to Jquery so I really need a some help from you guys.

I have created a button, when clicked a pop up menu will appear. Now I have created a script, what it does is when that button is clicked the sideshow on the site background will be hidden (this is to make the pop up menu much smoother), my question is after a user closes down the pop up menu, how can I reshow the hidden slideshow again , I believe it has something to do with this code onHide: function()

<script>
jQuery(document).ready(function(){
    jQuery('.menubutton').click(function(){
        jQuery("#slideshow").css({"display":"none"});
    });
});
</script>

To show and hide alternatively use .toggle()

jQuery("#slideshow").toggle()

Demo: Fiddle

To Hide an element use .hide()

jQuery("#slideshow").hide()

To Display a hidden an element use .show()

jQuery("#slideshow").show()

I believe jQuery.toggle() is what you are after:

jQuery(document).ready(function () {
    jQuery('.menubutton').click(function () {
        jQuery('#slideshow').toggle();
    });
});

Fiddle: http://jsfiddle.net/QGdLw/1/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM