移动端滚动条滚动收集

时间:2020-05-07 15:38:12   收藏:0   阅读:71

1.锚点链接

2.document.getElementById(rewardid).scrollIntoView(); 

3.

Math.easeout = function (A, B, rate, callback) {
    if (A == B || typeof A != ‘number‘) {
        return;    
    }
    B = B || 0;
    rate = rate || 2;
    
    var step = function () {
        A = A + (B - A) / rate;
        
        if (A < 1) {
            callback(B, true);
            return;
        }
        callback(A, false);
        requestAnimationFrame(step);    
    };
    step();
};
var doc = document.body.scrollTop? document.body : document.documentElement;
Math.easeout(doc.scrollTop, 0, 4, function (value) {
    doc.scrollTop = value;
});

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!