I keep stuggling with the animate function. in combination with the .toggle function. I simply try to make a div slide from right to left and visa versa on click. This is what I have:
Javascript:
HTMLCode:var w = $('.content').width(); $('#toggle').toggle(function() { $('div.content').animate({left: -600}, 600, function(){ $('#toggle').text("open"); }); return false; }, function() { $('div.content').animate({left: 0}, 900, function(){ $('##toggle'').text("close"); }); return false; });
When opening the page the content div slide automatically to the left and the toggle anchor slides to the right. What am I doing wrong, and can someone please explain me the .animate/.toggle functions in more detail.Code:<div id="content" class="content"> <div class="header"> <div class="close"><a href="##" id="toggle">Close</a></div> <h1>Title</h1> </div> </div>
Thank you in advance



Reply With Quote


Bookmarks