开发者

Is it possible to select text with iscroll on ipad?

We're using iscroll to enable a long div to scroll on ipad. However because iscroll has jacked the touch event, the users can no longer select text within the div.

Does anyone know if there is a workaround for this?

In theory iscroll should be respondi开发者_如何学Pythonng to drag not touch but in effect this doesnt seem to be happening.

Anyone else having this issue?


When you implement iScroll, the example files usually have a css rule of -webkit-user-select:none; on the body tag. This rule helps not to have the text selected if you just touch and hold before you decide to drag. Remove that line (comment it out) to restore the text selection functionality. However, this way the text selector might be coming up in the inopportune moments when the user is interacting with the iScroll-enabled area. Cheers


For IScroll 5 use the following code https://github.com/cubiq/iscroll/issues/439#issuecomment-53553645

To disable mouse-click-drag scroll and still have mouse-wheel-scroll use this for options:

mouseWheel: true,
disableMouse: true

p.s. This is also a good fix for the problem of not being able to highlight the text inside IScroll without stressfull injections through preventDefaultExceptions like here http://jsfiddle.net/UDF59/


Find this line in iscroll.js file:

129(for me): onBeforeScrollStart: function (e) { e.preventDefault(); },

Now simply use className of block where you want to allow text selection. Like this

onBeforeScrollStart: function (e) { if (!el.match("block")) e.preventDefault(); }

The agent will not prevent default behavior and will allow user to select text.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜