本文介绍了在iOS中按住文本不会在使用ajax时在jQueryMobile对话框中打开“复制”按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我说的是弹出的对话框之一:



(简短的移动网址)



点击打开对话框 - 在该对话框中,在iOS中没有可复制的东西,除非在链接中使用data-ajax =false。 (在Android上正常工作)



放置'-webkit-user-select:auto!important;'(或'text'而不是'auto' / p>

添加javascript'document.documentElement.style.webkitTouchCallout =auto;'不做任何操作。



我绝望的使这项工作,因为我已经建立了一个假设,复制将工作在iOS和Android,但没有在iOS中测试,直到它完成:(。

$ b $



编辑:在4.3.5 - 4.3.2 - iOS 5.1上测试 - 不工作

解决方案

恐怕我不能提供简单的回答你的问题,但我希望目前的解决方案是足够的。






问题



jquery.mobile.dialog.js 文件,其中有一行:

  $ el.bind(vclick submit,function(event){
// code
})

正如您所看到的,我们在 vclick

vmouse.js vmouse.js 中生成并在挖后,我设法发现实际问题出现的地方:

  $(this).bind(realType,dummyMouseHandler); 

此行是在一些浏览器中使事件工作所必需的,即Opera Mini




是其中一个解决方案,打开文件jquery.mobile.vmouse.js并注释掉

  $(this).bind realType,dummyMouseHandler); 

我在iPad上测试过,并且在那个小补丁后可以使用复制功能。


I am talking about one of these Dialog boxes that pop up:http://jquerymobile.com/test/docs/pages/page-dialogs.html

(short url for mobile http://bit.ly/KhCGVD)

Click 'Open Dialog' -- on that dialog box, nothing is copy-able in iOS without unless 'data-ajax="false"' is used in the link. (works fine on Android)

Putting '-webkit-user-select: auto!important;' (or 'text' instead of 'auto') does nothing.

Adding the javascript 'document.documentElement.style.webkitTouchCallout = "auto";' does nothing.

I am desperate to make this work as I have built an entire thing around the assumption that copy would work on it in iOS as well as android, but didn't test in iOS until it was finished :(.

Any help would be greatly appreciated, Thanks.

edit: tested on 4.3.5 -- 4.3.2 -- iOS 5.1 -- not working

解决方案

I'm afraid i can't provide simple answer to your question (like adding something in config or init), but i hope current solution will be sufficient.


Problem

Problem lies quite deep in the code of this framework. First of all we have a jquery.mobile.dialog.js file in which we have a line:

    $el.bind( "vclick submit", function( event ) {
               // code
            })

As you can see here we are adding a binding vclick to the $el - whole dialog box container.

Event vclick on it's own is generated by jQuery Mobile in vmouse.js and after digging there i managed to detect where actual problem arises:

    $( this ).bind( realType, dummyMouseHandler );

This line is required to make event work in some browsers, namely Opera Mini (as described in commented text above this line).


Solution

So, here is one of the solutions, open file jquery.mobile.vmouse.js and comment out line

    $( this ).bind( realType, dummyMouseHandler );

I've tested it on an iPad and copy functionality is available after that tiny patch.

这篇关于在iOS中按住文本不会在使用ajax时在jQueryMobile对话框中打开“复制”按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 05:32