Horizontal Sliding Panel v2
This is a follow up post from my popular jQuery horizontal sliding panel which believe it or not gets over 500 hits a month! Many people recently have been saying it doesn’t work with the latest version of jQuery (1.5.1) (1.7.0), I finally got a moment to get it fixed so people can continue to enjoy it.
Click here to view the demo
OK so the HTML stays the same as the previous version of the sliding panel.
The HTML
1 2 3 4 5 6 7 8 9 10 | <div id="panel"> <!--the hidden panel --> <div class="content"> <!--insert your content here --> </div> </div> <!--if javascript is disabled use this link--> <a href="/about.html" onclick="return()"> <div id="tab"> <!-- this will activate your panel. --> </div> </a> |
We make one change to the CSS in the panel styling.
The CSS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #tab { width:50px; height:150px; position:fixed; left:0px; top:100px; display:block; cursor:pointer; } #panel { position:fixed; left:0px; top:50px; background-color:#999999; height:500px; width:0;/*new line*/ } #panel .content { width:290px; margin-left:70px; } |
The Jquery
Really simple change to the jQuery, just removing the #panel ID from the first line and that’s all we are changing.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | $(document).ready(function(){ $(".content").hide(); //updated line, removing the #panel ID. $('#tab').toggle(function(){ //adding a toggle function to the #tab $('#panel').stop().animate({width:"400px", opacity:0.8}, 500, function() {//sliding the #panel to 400px $('.content').fadeIn('slow'); //slides the content into view. }); }, function(){ //when the #tab is next cliked $('.content').fadeOut('slow', function() { //fade out the content $('#panel').stop().animate({width:"0", opacity:0.1}, 500); //slide the #panel back to a width of 0 }); }); }); |
I hope this fixed peoples problems with the new jQuery. Let me know if you have any trouble.













Animating with webkit CSS3
I went to Europe!
Horizontal Sliding Panel v2