admin管理员组文章数量:1332361
I have a UI where users are scrolling a horizontally scrolling area.
I still want them to be able to scroll left and right, but I'd like to fire an Hammer.js pan event at the same time. Here's my code at present:
var worksHammertime = new Hammer(scrollingArea);
worksHammertime.on('pan', function(ev) {
if ( ev.direction === 2 ) {
log('left', ev)
Do things...
} else {
log('right', ev)
Do things...
}
});
Essentially I think I'm looking for the opposite of the preventDefault()
behaviour that Hammer seems to use by default. Can use hammer.js pan events and still allow users to scroll?
I have a UI where users are scrolling a horizontally scrolling area.
I still want them to be able to scroll left and right, but I'd like to fire an Hammer.js pan event at the same time. Here's my code at present:
var worksHammertime = new Hammer(scrollingArea);
worksHammertime.on('pan', function(ev) {
if ( ev.direction === 2 ) {
log('left', ev)
Do things...
} else {
log('right', ev)
Do things...
}
});
Essentially I think I'm looking for the opposite of the preventDefault()
behaviour that Hammer seems to use by default. Can use hammer.js pan events and still allow users to scroll?
2 Answers
Reset to default 5Apply a CSS property:
#touch-area
{
touch-action: pan-x pan-y !important;
}
This currently isn't supported, but you could try to do this with a nested element containing style="overflow: auto;"
本文标签: javascriptCan use hammerjs pan events and still allow users to scrollStack Overflow
版权声明:本文标题:javascript - Can use hammer.js pan events and still allow users to scroll? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742318939a2452385.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论