Reputation: 29
I have a sliding panel at the top of my website design, but its default is to be open at the m,oment on page load - how can I get it to be closed on default and then click the toggle to open, instead of the reverse which it is doing now? JQuery below:
$(document).ready(function(){
$("#toggle").click(function(){
$(".panel").toggle("slow");
$(this).toggleClass("active");
return false;
});
});
Upvotes: 0
Views: 273
Reputation: 4393
Use this class and make display property as none which could it wont display on window loading.
.panel{display:none; }
Upvotes: 3
Reputation: 161
Use the class panel and make display property as none which could it wont display at the moment of loading the page.
.panel{display:none; }
Upvotes: 3
Reputation: 206048
IF you want to prevent on document load to see that panel "flash" from 'visible' to hidden than just hide it initially with CSS:
.panel{display:none;}
Upvotes: 0