Galleria 和 JQuery Swipe。控制?
尝试在 JQuery 中运行 Galleria 和 Swipe。
示例可在以下位置找到: http://www.mikelastphoto.com/ipad/
问题:一切正常,但 iPad 上的滑动控制整个页面除外。我不介意是否无法捏合/缩放(尽管这很好),但我无法沿 Y 轴滑动以查看页面底部的其余缩略图。本质上,我希望只能在图像本身上进行滑动,并像平常一样上下滑动以滚动。
我相信问题出在 JQuery.Swipe.js 内的这条语句中。
// Done Swiping
// Swipe should only be on X axis, ignore if swipe on Y axis
// Calculate if the swipe was left or right
function touchEnd(event) {
console.log('Ending swipe gesture...')
var changeY = originalCoord.y - finalCoord.y
if(changeY < defaults.threshold.y && changeY > (defaults.threshold.y*-1)) {
changeX = originalCoord.x - finalCoord.x
if(changeX > defaults.threshold.x) {
defaults.swipeLeft()
}
if(changeX < (defaults.threshold.x*-1)) {
defaults.swipeRight()
}
}
}
因为 Y 只是被忽略,而不是留给 Safari 来解释。
$(document).swipe({
swipeRight: function() { $.galleria.prev(); return false; },
swipeLeft: function() { $.galleria.next(); return false; },
});
这是我需要将滑动应用于 jpeg 而不是页面其余部分的部分吗?
Trying to run Galleria and Swipe in JQuery.
Example can be found at: http://www.mikelastphoto.com/ipad/
Problem: Everything works, except for the swipe taking over control of the entire page on the iPad. I don't mind if I can't pinch/zoom (although that would be nice) but I am unable to swipe along the Y axis to view the rest of the thumbnails at the bottom of the page. Essentially I would like the swipe to only be possible on the image itself, and swiping up and down to scroll like normal.
I believe the problem is in this statement inside JQuery.Swipe.js.
// Done Swiping
// Swipe should only be on X axis, ignore if swipe on Y axis
// Calculate if the swipe was left or right
function touchEnd(event) {
console.log('Ending swipe gesture...')
var changeY = originalCoord.y - finalCoord.y
if(changeY < defaults.threshold.y && changeY > (defaults.threshold.y*-1)) {
changeX = originalCoord.x - finalCoord.x
if(changeX > defaults.threshold.x) {
defaults.swipeLeft()
}
if(changeX < (defaults.threshold.x*-1)) {
defaults.swipeRight()
}
}
}
Because the Y is just being ignored, but not being left to Safari to interpret.
$(document).swipe({
swipeRight: function() { $.galleria.prev(); return false; },
swipeLeft: function() { $.galleria.next(); return false; },
});
Is this the section I will need to apply the swipe just to the jpeg and not the rest of the page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为问题是
$(document).swipe(event)
尝试将其仅应用于您的 div$(#yourdiv).swipe(event)
I think the problem is
$(document).swipe(event)
try applying it just to your div$(#yourdiv).swipe(event)