【问题标题】:Mobile Application - Wait for element / page to load移动应用程序 - 等待元素/页面加载
【发布时间】:2014-04-17 12:27:22
【问题描述】:

我有一个按钮,可以将我的移动应用程序从 index.html 切换到不同的 .html 页面。这只是通过a href= bla bla 完成的。同时,在 Javascript 文件中触发了点击事件。

但是,我想等待新的 .html 页面(如果不可能,我想等到我想要访问的所需 div 存在)加载,然后再执行所需的功能。我尝试使用谷歌搜索并以 live()、on()、$(window).bind("load" .. - 但这些似乎都不起作用。

【问题讨论】:

    标签: jquery html mobile wait


    【解决方案1】:

    在目标 div 中放置一个透明的 1x1 png。

    $('img.myPNG').load(function(){ doThangs() });
    

    【讨论】:

    • $('#imgTarget').load(function(){ alert('hi') }); - 不给我警报。 (我在所需文章中的 .html 页面中添加了图像。)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-11-14
    • 1970-01-01
    • 1970-01-01
    • 2021-02-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多