<script type="text/javascript">
var scrollToTopBox = document.getElementById('scrollToTop');
//返回按钮tap
scrollToTopBox.addEventListener('tap', function(e) {
e.stopPropagation();
mui("#scroll1").scroll().scrollTo(0,0,100);//滚动到顶部
});
document.getElementById('scroll1').addEventListener('scroll', function() {
if (mui('#scroll1').scroll().y <= window.innerHeight (-1) && scrollToTopBox.classList.contains('hide')){
scrollToTopBox.classList.remove('hide');
}else if(mui('#scroll1').scroll().y > window.innerHeight (-1) && !scrollToTopBox.classList.contains('hide')){
scrollToTopBox.classList.add('hide');
}
});
</script>
0 个回复