AngelaK
AngelaK

Reputation: 11

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>

Upvotes: 0

Views: 497

Answers (2)

Arun P Johny
Arun P Johny

Reputation: 388316

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()

Upvotes: 3

Francis Kim
Francis Kim

Reputation: 4285

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/

Upvotes: 1

Related Questions