刚开始打开页面,右下角菜单是隐藏的,当滚动条滚动到一定距离,便显示菜单。当滚动条到顶端的时候会隐藏菜单。
0、请不要问“在不在”之类的问题,有问题直接问!1、学生或暂时没有工作的童鞋,整站资源免费下载!2、¥9.9充值终身VIP会员,加我微信,826096331 拉你进VIP群学习!3、程序员加油,技术改变世界。在线 充值
右下角菜单html代码
<div id="cd-nav">
<a href="javascript:void(0)" class="cd-nav-trigger">Menu<span></span></a>
<nav id="cd-main-nav">
<ul>
<li><a href='http://www.erdangjiade.com/js/362.html' target='_blank'>PHP汉语拼音转换</a></li> <li><a href='http://www.erdangjiade.com/js/363.html' target='_blank'>BoxSlider演示3种滚动内容方式</a></li> <li><a href='http://www.erdangjiade.com/js/364.html' target='_blank'>jQuery表单美化插件cForm</a></li> <li><a href='http://www.erdangjiade.com/js/365.html' target='_blank'>Xslider演示8种滚动效果</a></li>
</ul>
</nav>
</div>
滚动时判断是否显示右下角菜单
$(window).scroll(function() {
checkMenu();
});
function checkMenu() {
if ($(window).scrollTop() > offset && !navigationContainer.hasClass('is-fixed')) {
navigationContainer.addClass('is-fixed').find('.cd-nav-trigger').one('webkitAnimationEnd oanimationend msAnimationEnd animationend', function() {
mainNavigation.addClass('has-transitions');
});
} else if ($(window).scrollTop() <= offset) {
//check if the menu is open when scrolling up
if (mainNavigation.hasClass('is-visible') && !$('html').hasClass('no-csstransitions')) {
//close the menu with animation
mainNavigation.addClass('is-hidden').one('webkitTransitionEnd otransitionend oTransitionEnd msTransitionEnd transitionend', function() {
//wait for the menu to be closed and do the rest
mainNavigation.removeClass('is-visible is-hidden has-transitions');
navigationContainer.removeClass('is-fixed');
$('.cd-nav-trigger').removeClass('menu-is-open');
});
//check if the menu is open when scrolling up - fallback if transitions are not supported
} else if (mainNavigation.hasClass('is-visible') && $('html').hasClass('no-csstransitions')) {
mainNavigation.removeClass('is-visible has-transitions');
navigationContainer.removeClass('is-fixed');
$('.cd-nav-trigger').removeClass('menu-is-open');
//scrolling up with menu closed
} else {
navigationContainer.removeClass('is-fixed');
mainNavigation.removeClass('has-transitions');
}
}
}
友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群