Hammer.js: hammerjs prevents text selection on iOS

Created on 20 Jul 2012  路  4Comments  路  Source: hammerjs/hammer.js

I need a text selection feature for my current project but hammerjs prevents it.
How i can enable this feature without loosing basic functional of hammerjs (tap & doubletap actions)?

Most helpful comment

delete Hammer.defaults.cssProps.userSelect;

Place this before the initialization of your hammer object.

All 4 comments

I have the same problem

Would love to be able to do this as well.

Have you read about "stop_browser_behavior", here: https://github.com/EightMedia/hammer.js/issues/81 ?
If I set it to false, text selection seems to work, in Chrome desktop at least. Like so:

$=jQuery;
Hammer($('body')[0], {prevent_default: false, stop_browser_behavior: false}).on("swiperight", function(event) {
    console.log('swiperight hello!');
});

delete Hammer.defaults.cssProps.userSelect;

Place this before the initialization of your hammer object.

Was this page helpful?
0 / 5 - 0 ratings