我有一个侧边栏菜单,当我点击其中一个菜单项博客时,我试图向上滑动并且不在视线范围内。像这样:fiddle。它在Dreamweaver实时预览中显示得很好,但在浏览器中却没有。 HEre是我的HTML:
<div id="sidebar">
<div id="navigation">
<div id="logo">
<img src="Logos/headerlogo.jpg" width="208" height="80" longdesc="Logos/headerlogo.jpg">
</div>
<hr size=1 width=179 align=left style="margin-left:17px; margin-bottom:20px">
<div class="menu">
<ul class="first" >
<li> <a href="" title="" runat="server">Home</a></li>
<li> <a href="" title="" runat="server">Blog</a></li>
<li> <a href="" title="" runat="server">Instagram</a></li>
<li> <a href="" title="" runat="server">About</a></li>
<li> <a href="" title="" runat="server">Store</a></li>
<li> <a href="" title="" runat="server">Portfolio</a></li>
<li> <a href="" title="" runat="server">Contact</a></li>
</ul>
</div>
我的剧本:
<script type="text/javascript">
$(document).ready(function () {
$('.first .blog').click(function(){
$('#sidebar').animate({
"marginTop": "-=500px" //animate margin to create slide up animation
}, 1000); //duration of animation, in milliseconds
});
});
</script>