We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当我手动滑动的距离大于50px的时候,监听panend调用xscroll.scrollTop('-' + 400, 400, 'ease-in-out')以后,再次触摸的时候会跳一下,查看源码得知: if (boundryCheck) { //over top y = y > boundry.top ? bounce ? (y - boundry.top) * PAN_RATE + boundry.top : boundry.top : y; //over bottom y = y < boundry.bottom - containerHeight ? bounce ? y + (boundry.bottom - containerHeight - y) * PAN_RATE : boundry.bottom - containerHeight : y; //over left x = x > boundry.left ? bounce ? (x - boundry.left) * PAN_RATE + boundry.left : boundry.left : x; //over right x = x < boundry.right - containerWidth ? bounce ? x + (boundry.right - containerWidth - x) * PAN_RATE : boundry.right - containerWidth : x; } 在这里判断有问题。boundry的值是触摸的位置,应该是scrollTop最后的位置,所以导致会跳一下。希望解决,下面是我的代码 ` var xscroll = new XScroll({ renderTo:"#dayContainer", lockY:false, scrollbarY:false }); xscroll.render(); xscroll.on('scroll', function (scroll) { $('.history-cala').css({ opacity: Math.abs(scroll.scrollTop/$('.history-cala').outerHeight(true)) }) })
xscroll.scrollTop('-' + 400, 400, 'ease-in-out')
if (boundryCheck) { //over top y = y > boundry.top ? bounce ? (y - boundry.top) * PAN_RATE + boundry.top : boundry.top : y; //over bottom y = y < boundry.bottom - containerHeight ? bounce ? y + (boundry.bottom - containerHeight - y) * PAN_RATE : boundry.bottom - containerHeight : y; //over left x = x > boundry.left ? bounce ? (x - boundry.left) * PAN_RATE + boundry.left : boundry.left : x; //over right x = x < boundry.right - containerWidth ? bounce ? x + (boundry.right - containerWidth - x) * PAN_RATE : boundry.right - containerWidth : x; }
var startY = 0; xscroll.on('panend', function (e) { var top = xscroll.getScrollTop(); var diff = top - startY; console.log(diff + '...' + top) if(Math.abs(diff) > 30){ if(diff < 0){ xscroll.scrollTop('-' + $('.history-cala').outerHeight(true), 400, 'ease-in-out') } else { xscroll.scrollTop(0, 400, 'ease-in-out') } setTimeout(function () { xscroll.init() }, 400) } }) xscroll.on('panstart', function (e) { startY = xscroll.getScrollTop() })`
The text was updated successfully, but these errors were encountered:
No branches or pull requests
当我手动滑动的距离大于50px的时候,监听panend调用
xscroll.scrollTop('-' + 400, 400, 'ease-in-out')
以后,再次触摸的时候会跳一下,查看源码得知:if (boundryCheck) { //over top y = y > boundry.top ? bounce ? (y - boundry.top) * PAN_RATE + boundry.top : boundry.top : y; //over bottom y = y < boundry.bottom - containerHeight ? bounce ? y + (boundry.bottom - containerHeight - y) * PAN_RATE : boundry.bottom - containerHeight : y; //over left x = x > boundry.left ? bounce ? (x - boundry.left) * PAN_RATE + boundry.left : boundry.left : x; //over right x = x < boundry.right - containerWidth ? bounce ? x + (boundry.right - containerWidth - x) * PAN_RATE : boundry.right - containerWidth : x; }
在这里判断有问题。boundry的值是触摸的位置,应该是scrollTop最后的位置,所以导致会跳一下。希望解决,下面是我的代码
` var xscroll = new XScroll({
renderTo:"#dayContainer",
lockY:false,
scrollbarY:false
});
xscroll.render();
xscroll.on('scroll', function (scroll) {
$('.history-cala').css({
opacity: Math.abs(scroll.scrollTop/$('.history-cala').outerHeight(true))
})
})
The text was updated successfully, but these errors were encountered: