jquery slideToggle's position
Posted
by skargor
on Stack Overflow
See other posts from Stack Overflow
or by skargor
Published on 2009-07-15T04:56:03Z
Indexed on
2010/03/13
8:05 UTC
Read the original article
Hit count: 190
I have a menu div to put the menu list inside
<!--menu-->
<a href="#"><div id="menu-tab">Menu</div></a>
<div id="menu">
<ul>
<li><a href="#">a</a></li>
<li><a href="#">b</a></li>
<li><a href="#">c</li>
</ul>
</div>
for the css
#menu {
width: 220px;
border: 2px solid #004990;
float: right;
margin-right: 15px;
margin-top: -52px;
}
here is the javascript/jquery
$('#menu-tab').click(function(){
$("#menu").slideToggle("normal");
});
becuase margin-top: -52px;(which I control the menu position in the page), therefore each time when I click the menu tab, the #menu will slide from -52px. how can I let it slide from 0px?
© Stack Overflow or respective owner