简体   繁体   English

iScroll 4:滚动时禁用锚点

[英]iScroll 4: Disable anchors when scrolling

iScroll 4: http://cubiq.org/iscroll-4 iScroll 4: http ://cubiq.org/iscroll-4

I would to know if it is possible to prevent the mouse release event on anchors (ie follow link) if the release happens after scrolling. 我想知道如果滚动后释放发生了,是否可以防止锚点上的鼠标释放事件(即跟随链接)。 In other words, i would that anchors works only if i make a single, non dragging, click. 换句话说,只有在我进行一次非拖动的单击时,锚才会起作用。

The problem is when i have a big image within an tag and if i scroll and release inside the img area, then the link is followed, but this is not the intended behavior. 问题是当标签中有大图像时,如果我在img区域内滚动并释放,则跟随该链接,但这不是预期的行为。

The ideal solution would be to return false on mouse release if it happens after dragging. 理想的解决方案是,如果在拖动后发生鼠标释放,则返回false。

Thanks 谢谢

Try adding this to the code where you initiate iScroll 尝试将其添加到启动iScroll的代码中

document.addEventListener('touchmove', function (e) {
    e.preventDefault();
}, false);

It should prevent links from firing whilst the user is scrolling 它应防止在用户滚动时触发链接

Hope this helps! 希望这可以帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM