jquery - .slideToggle acting not as it should? -
when user clicks on sidebar want toggle in or out. can seem happen here code have:
jquery code:
$(function() { $("a#toggle").click(function(e) { e.preventdefault(); $("#aside").slidetoggle(); return false; }); });
html:
<div class="wrap" id="aside"> <aside class="left-aside"> <header class="aside-header"> <h1>stuff</h1> </header> </aside> </div> <a id="toggle">sidebar</a>
and css:
#aside { display: none; }
you should try sliding
<html lang="en"> <head> <meta charset="utf-8"> <title>jquery.getjson demo</title> <style> #aside { display: none; </style> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $(document).ready(function(){ $(function() { $("#toggle").click(function(e) { e.preventdefault(); $("#aside").slidetoggle(); return false; }); }); }); </script> </head> <body> <div class="wrap" id="aside"> <aside class="left-aside"> <header class="aside-header"> <h1>stuff</h1> </header> </aside> </div> <a id="toggle">sidebar</a> </body> </html>
Comments
Post a Comment