从jquerymobile 1.2.1迁移到1.4.5 [英] migrate from jquerymobile 1.2.1 to 1.4.5

查看:120
本文介绍了从jquerymobile 1.2.1迁移到1.4.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从jquerymobile 1.2迁移到1.4.5

I am migrating up from jquerymobile 1.2 to 1.4.5

我的应用程序中每个页面的内容均以以下语法开头

the content for each of my pages on my app commences with the following syntax,

$("#DemoAccountRegistrationPage").live("pageshow", function() {

我能够弄清楚我需要将.live转换为.on,以便以上内容成为每个页面的参考

I have been able to figure out i need to transition the .live to .on so the above becomes each page reference

$("#DemoAccountRegistrationPage").on("pagecontainershow", function() {

但是我意识到上面的格式仍然不符合1.4.5,因此为什么内容没有加载

however i realise that the above format is still not compliant for 1.4.5 hence why the content is not loading

有人可以给我提供正确的语法以进行更改

can someone please provide me the correct syntax to be able to change

$("#DemoAccountRegistrationPage").on("pagecontainershow", function() { 

符合1.4.5的正确语法

to the correct syntax for compliance with 1.4.5

我已经阅读了jQuery文档,但无法完全理解正确的语法是什么(对于jquery mobile来说是全新的东西)

I have read over the jquery docs but cannot fully understand what the correct syntax needs to be (very new to jquery mobile)

推荐答案

这对我有用,因为我正在其中一个项目中使用它:

This works for me, as i'm using it in one of my projects:

$(document).on("pagecontainershow", function(e, ui) { 
    var pageId = $(":mobile-pagecontainer").pagecontainer("getActivePage").prop("id");
    if (typeof ui.toPage == "object") {
        /* manipulate page navigating to */
        switch(pageId) {
            case "page-one":
                //do stuff
                break;
            case "page-two":
                // do other stuff
                break;
        }
    }
});

这篇关于从jquerymobile 1.2.1迁移到1.4.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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