显式初始化Jquery Mobile? [英] Explicitly initializing Jquery Mobile?

查看:179
本文介绍了显式初始化Jquery Mobile?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jquery mobile。我只是想停止jquery mobile做任何事情,除非我明确调用trigger('create')方法。是否有办法停止jQuery移动自动初始化一段时间。

解决方案


  • 可以通过添加此属性来实现:

      data-enhancement =false



    您还需要在应用加载阶段开启此功能:

      $(document).one(mobileinit (){
    $ .mobile.ignoreContentEnabled = true;
    });

    有关详情,请参阅:



    http://jquerymobile.com/test/docs/pages/page-scripting .html



    示例:



    http://jsfiddle.net/Gajotres/Xjurd/



    您可以通过启用/停用 $。mobile.ignoreContentEnabled = true;




    • 是手动使用此行:

        data-role =none




    示例:



    http://jsfiddle.net/Gajotres/LqDke/



    编辑:



    要再次重新创建网页,请使用:

      $('#index')。live('pagebeforeshow',function(event){
    $ .mobile.ignoreContentEnabled = false;
    $(this).attr('data-enhancement','true');
    $(this).trigger(pagecreate)
    });


    I am using jquery mobile. I just wanted to stop jquery mobile to do anything unless I explicitly call trigger('create') method. Is there a way to stop jquery mobile auto initialization for some time.

    解决方案

    • You can do it by adding this attribute:

      data-enhance="false"
      

    to a wanted container.

    And you also need to turn this on in the app loading phase:

    $(document).one("mobileinit", function () {
        $.mobile.ignoreContentEnabled=true;
    });
    

    More about this can be found here:

    http://jquerymobile.com/test/docs/pages/page-scripting.html

    Example:

    http://jsfiddle.net/Gajotres/Xjurd/

    You can test it by enabling/disabling $.mobile.ignoreContentEnabled=true;

    • Second option is to do it manually with this line:

      data-role="none"
      

    Example:

    http://jsfiddle.net/Gajotres/LqDke/

    EDIT :

    To recreate a page again use this:

    $('#index').live('pagebeforeshow', function (event) {
        $.mobile.ignoreContentEnabled = false;
        $(this).attr('data-enhance','true');
        $(this).trigger("pagecreate")
    });
    

    这篇关于显式初始化Jquery Mobile?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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