Mark Anthony Byrne
Mark Anthony Byrne

Reputation: 29

Sliding panel jquery

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

Answers (3)

Karthi Keyan
Karthi Keyan

Reputation: 4393

Use this class and make display property as none which could it wont display on window loading.

.panel{display:none; }

Upvotes: 3

Murugan Kumarasamy
Murugan Kumarasamy

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

Roko C. Buljan
Roko C. Buljan

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

Related Questions