jQuery UI对话框()无法在iPad上打开 [英] jQuery UI dialog() won't open on iPad

查看:343
本文介绍了jQuery UI对话框()无法在iPad上打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型的网络应用程序,只不过是几个HTML页面。我希望在我的应用程序中使用jQuery UI对话框,我在Mac和PC(Sarafi,Chrome,Firefox)上的浏览器中工作,我已部署到android(Xoom 2),但一切都很好,但是对话框不是我在iPad(IPad 2)上测试时被解雇了。我还注意到,在iPad上查看页面时,不会隐藏包含对话框内容的DIV。

I have a small web app that is nothing more than a few HTML pages. I wish to use the jQuery UI dialog within my app and I have it working in the browser on my Mac and PC (Sarafi, Chrome, Firefox) and I have deployed to android (Xoom 2) and all is well however the dialog is not fired when I test on the iPad (IPad 2). I've also noticed that the DIV which contains the dialog content is not hidden when viewing the page on the iPad.

这是我的JS代码......

Here's my JS code...

$('#entry_level_phones .boxHolder').live("click", function(){

    var clickedItem = $(this).find("img")[0].id;

    console.log(clickedItem);
    // raise a modal...
    $(function() {
        $( "#dialog-modal" ).dialog({
            modal: true,
            draggable:false,
            height:600,
            position:"center",
            resizable:false,
            width:1000
        });

   // more happens here which isn't important... but there is no conflict or error
  });
});

这是相关的DIV ......

this is the associated DIV...

<div id="dialog-modal" title="">
    <p>Hello World</p>
</div>

通过放置 alert()进行测试要查看是否正在引发click事件,执行测试警报,因此它不是click事件的问题,它是对话框本身或者没有加载jQuery UI。

When testing by putting an alert() to see if the click event is being raised the test alert is executed, so it is not an issue with the click event, it is the dialog itself or jQuery UI isn't being loaded.

我也试图像这样举起一个对话,而不是与DIV或事件相关联,但即使这样也不起作用

I also tried to raise a dialog like this, without being associated with a DIV or an event but even this didn't work

$( "<div>this is a test</div>" ).dialog()

有没有其他人在使用iPad对话框时遇到问题?

Has anyone else had issues using the dialog with the iPad?

我不确定这是不是相关但我的应用程序是一个mainHTML文件,使用.load()方法引入HTML内容

I'm not sure if this is relevant however my app is one mainHTML file that brings in HTML content using the .load() method

推荐答案

很抱歉回答我自己的问题问题,但我检查了UI是否正在加载...

Sorry to answer my own question but I put a check in to see if the UI was being loaded...

var isiPad = navigator.userAgent.match(/iPad/i) != null;

if(!jQuery.ui && isiPad == true){
    // do stuff...
    }

我考虑过动态地将UI脚本附加到我的网页正文中,但是我使用的是jQuery UI的托管版本。当我通过下载替换本地版本的问题似乎消失了...因此答案是托管版本加载太长时间或根本没有加载。对不起戏剧......

I thought about dynamically appending the UI script back to the body of my webpage however I was using the hosted version of jQuery UI. When I replaced this for a local version by downloading the problem seemed to go away... thus the answer is the hosted version was taking too long to load or not loading at all. Sorry for the drama...

这篇关于jQuery UI对话框()无法在iPad上打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆