我想要一个div在内容加载后从屏幕下方向上滑动,然后当用户单击菜单按钮时,我希望div在屏幕外滑动。如何使用jQuery在边框和屏幕外使用边距动画div?
但
,因为它滑,我希望它从屏幕的最底部没有出现,而是从,说,100像素在屏幕的底部 - 当它离屏幕上滑,我想它开始消失在屏幕上边缘下方约100px处。
我使用这个代码:
<script type="text/javascript">
$(window).load(function(){
$('#content').animate({top: "150px"}, 2000); <!-- to make the #content div slide in -->
$('body').css('overflow', 'hidden'); <!-- to remove the sidebar -->
$('#navButton').click(function() {
$('#content').animate({top: "-500px"}, 750); <!-- to make the #content div slide out on click -->
});
我可以添加/修改以达到我想要的效果?
请多多指教。
你能举个例子吗? - Dimitri Vorontzov – 2011-05-05 16:55:31
谢谢,这正是我想要的。 – 2011-05-05 17:52:23
Robert,在添加jScrollPane插件之前,您的代码工作良好,但会干扰插件。我确信必须有一个非常简单的解决方案,但我只是看不到它。请给点意见? – 2011-05-05 22:23:11