Javascript jquery mobile中未打开弹出窗口
我已经在我的ipad上实现了一个脚本来阻止我的移动应用程序中的链接 它工作得很好,但我现在对jquery mobile的弹出窗口有问题 问题是当我使用这个脚本时,弹出窗口不再打开 如何打开弹出窗口 剧本:Javascript jquery mobile中未打开弹出窗口,javascript,jquery,html,jquery-mobile,Javascript,Jquery,Html,Jquery Mobile,我已经在我的ipad上实现了一个脚本来阻止我的移动应用程序中的链接 它工作得很好,但我现在对jquery mobile的弹出窗口有问题 问题是当我使用这个脚本时,弹出窗口不再打开 如何打开弹出窗口 剧本: (function(document,navigator,standalone) { // prevents links from apps from oppening in mobile safari // this javascript must be the first s
(function(document,navigator,standalone) {
// prevents links from apps from oppening in mobile safari
// this javascript must be the first script in your <head>
if ((standalone in navigator) && navigator[standalone]) {
var curnode, location=document.location, stop=/^(a|html)$/i;
document.addEventListener('click', function(e) {
curnode=e.target;
while (!(stop).test(curnode.nodeName)) {
curnode=curnode.parentNode;
}
// Condidions to do this only on links to your own app
// if you want all links, use if('href' in curnode) instead.
if('href' in curnode && ( curnode.href.indexOf('http') ||
~curnode.href.indexOf(location.host) ) ) {
e.preventDefault();
location.href = curnode.href;
}
},false);
}
})(document,window.navigator,'standalone');
(功能(文档、导航器、独立){
//防止来自应用程序的链接在mobile safari中出现
//此javascript必须是您的应用程序中的第一个脚本
if((导航器中的独立)和&navigator[独立]){
var curnode,location=document.location,stop=/^(a | html)$/i;
document.addEventListener('click',函数(e){
curnode=e.target;
while(!(停止).test(curnode.nodeName)){
curnode=curnode.parentNode;
}
//有条件仅在指向您自己应用程序的链接上执行此操作
//如果需要所有链接,请改用if('href'在curnode中)。
如果curnode&&(curnode.href.indexOf('http')中的('href'))||
~curnode.href.indexOf(location.host))){
e、 预防默认值();
location.href=curnode.href;
}
},假);
}
})(文档,window.navigator,'standalone');
在这种情况下,您需要以编程方式打开它
$('#popupID').popup('open');
解决了它
我所做的:
instad要使用我上面写的脚本,我只在
中使用此代码
这允许我在全屏模式下查看我的应用程序。。要在页面之间导航而不在浏览器中打开,请将页面加载到我的应用程序中。omar i do。。但是不要open@user2232273可能您没有将其绑定到正确的事件。我已经尝试了很多方法,但是弹出窗口仍然没有打开。是否有任何错误?尝试
.show()代码>至少要检查弹出div是否在DOM中。我必须在哪里写这个?有人有想法吗。。。我还没有解决它是的你找到了一种通过编程打开的方法吗?我的也可以在桌面上工作,但不能在手机上打开。
<a onclick="parent.location='root/example.html'" id="ex"></a>