jquery 判断滚动位置

来源:互联网 发布:孔浩 java web 编辑:程序博客网 时间:2024/06/05 18:17
$(document).ready(function(){    $(document).scroll(function(){        var top = $(document).scrollTop();        height = parseInt($("#topbar").css("height"));        console.log("height is" + height);        if(top < height) {            console.log("aaaaaaaaaaa");            $("#navagtionbar_left").css({"position":'',"top":'',"z-index":''});        } else {            console.log("bbbbbbbbbb");            $("#navagtionbar_left").css({"position":"fixed","top":"10px","z-index":"20"});        }    });});
原创粉丝点击