大佬教程收集整理的这篇文章主要介绍了从页面顶部滑动导航菜单 – Jquery,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
任何有关提示的帮助都将非常感激.
有关更多详细信息,请参阅我jsfiddle:http://jsfiddle.net/headex/tJNXD/
首先,我在这里使用$(nav)选择器,但您可以先将其调整到您的代码中.@H_301_20@此外,你需要把你的菜单:position:relative;或位置:绝对;
为了让它滑出:
$(nav).animate({"top":$(nav).height() * -1},"slow");
要使其滑入:
$(nav).animate({"top":0},"slow");
如果你想在3秒后弹出,我们走了:
function MenuOut() { /* The sample code I put on top */ $(nav).animate({"top":$(nav).height() * -1},"slow"); }
/* This will run once the document is ready */ $(function() { setTimeout("MenuOut",3000); /* 3000 represent 3000 milliseconds,so 3 seconds */ });
现在按钮:
function MenuIn() { $(nav).animate({"top":0},"slow"); }
并将它绑定到您的按钮,如下所示:
$('#theButton').on( { click: function() { /* Hide the button,and then show up the menu */ $(this).animate({"top":$(this).height() * -1},"slow",function() { /* I putted this in a callBACk function,so the 2 animations will be one after the other,not at the same time ! */ MenuIn(); }); } });
以上是大佬教程为你收集整理的从页面顶部滑动导航菜单 – Jquery全部内容,希望文章能够帮你解决从页面顶部滑动导航菜单 – Jquery所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。