var pageY = null, endY = null;
dropDownLoad()
$(window).scroll(function () {
if (!document.documentElement.scrollTop) {
dropDownLoad()
}
})
function dropDownLoad() {
// 要下拉的元素
$('.allDynamicsView').on({
// 触摸事件
touchstart: function (e) {
// 获取当前触摸位置
pageY = e.touches[0].pageY;
$(this)[0].style.position = 'relative';
$(this)[0].style.transition = 'transform 0s';
}
});
// 手指滑动事件
$('.allDynamicsView').on({
touchmove: function (e) {
// 获取离开位置
endY = e.touches[0].pageY - pageY;
endY = endY > 200 ? 200 : endY;
$(this)[0].style.transform = 'translateY(' + endY + 'px)';
if (!endY && endY < 60) {
}
}
});
// 手指离开事件
$('.allDynamicsView').on({
touchend: function (e) {
$(this)[0].style.transition = 'transform 0.5s ease';
$(this)[0].style.transform = 'translateY(0px)';
}
});
}
h5下拉刷新
最新推荐文章于 2024-06-16 19:46:16 发布