码迷,mamicode.com
首页 > 其他好文 > 详细

滚动条事件

时间:2019-10-16 09:53:53      阅读:63      评论:0      收藏:0      [点我收藏+]

标签:div   距离   osi   class   ons   高度   fun   fixed   滚动条事件   

window.onscroll = function (ev) {
        //console.log("距离顶部的高度:"+$(document).scrollTop());
        var heightY = $(document).scrollTop();
        var x = $(document).scrollLeft();
        if(heightY > 0){
            console.log("距离顶部的高度:"+heightY);
            $("#threadId").css("position","fixed");
        }
        if(x > 0 ){
            console.log("距离左边:"+x);
            $("#threadId").css("position","static");
        }
    }

  滚动条滚动时,发生的事件

滚动条事件

标签:div   距离   osi   class   ons   高度   fun   fixed   滚动条事件   

原文地址:https://www.cnblogs.com/lazyli/p/11683394.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!