zepto.js scrollTop method fails in a mobile terminal in question chrome

problem

Is developing a mobile web, using a relatively lightweight zepto.js, when moving the end chrome test, suddenly found Top of functional failure, there is no error, other browsers are run through, after solve recorded.

//这段代码在chrome移动端失效
$(document.body).scrollTop(0);

Solution

Have this problem change the following code

//将事件挂载到window对象上,就可以正常运行了
$(window).scrollTop(0);

other

Collating my own learning process read books and other books ready to watch, I want to help, the next will continue to update up new books:
JavaScript eBook Collection

Published 25 original articles · won praise 31 · views 110 000 +

Guess you like

Origin blog.csdn.net/qq_33236453/article/details/78814653