鼠标滑动判断与y轴的距离

时间:2021-09-01 14:33:44
 $(window).scroll(function(){
                        var y = window.scrollY;//754到达
                        if(y > 754){
                            $("#mynav").css({position:"fixed",top:0});
                        }else{
                            $("#mynav").css({position:"relative"});
                        }

});