您好,欢迎来到教玩游戏。
搜索
您的当前位置:首页jquery实现的导航固定效果_jquery

jquery实现的导航固定效果_jquery

来源:教玩游戏


jquery实现的导航固定效果

代码如下:
1.jquery代码, .nav为导航的class
$(function(){
$(window).scroll(function() {
if($(window).scrollTop()>=250){
$(".nav").addClass("fixedNav");
}else{
$(".nav").removeClass("fixedNav");
}
});
});

2.CSS代码
.fixedNav{
position:fixed;
top:0px;
left:0px;
width:100%;
z-index:100000;
_position:absolute;
_top:expression(eval(document.documentElement.scrollTop));
}

3.HTML代码

导航固定



Copyright © 2019- lvjiaowang.com 版权所有

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务