jQuery Mobile:如何使用动态DOM操作刷新页面? [英] jQuery Mobile: How to refresh page with dynamic DOM manipulation?

查看:155
本文介绍了jQuery Mobile:如何使用动态DOM操作刷新页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery Mobile创建了一个页面,并尝试动态添加内容:

I created a page with jQuery Mobile, and tried to add content dynamically:

    $(function () {

        $("#deviceTarget").sortable({
            revert: true
        });

        $("body > div[data-role='page']").append($("<div data-role='header' data-theme='a' data-position='fixed'><h1>Header</h1></div>"));
        $("body > div[data-role='page']").append($("<div data-role='footer' data-theme='a' data-position='fixed'><h1>Footer</h1></div>"));
        $.mobile.activePage.trigger("create");

    });

    $(document).bind('mobileinit',function(){
        $.mobile.defaultPageTransition = 'none';
        $.mobile.selectmenu.prototype.options.nativeMenu = false;
      });

    function refreshPage() {
        $.mobile.activePage.trigger("create");
    }

但是我得到了结果(图片).

But I got the result (image).

我想获取结果(图片).

我该怎么办?

谢谢.

推荐答案

所有您需要做的就是刷新页面

all you need to do is to refresh the page

不确定该代码:

    $.mobile.activePage.trigger("refresh");

但它应该可以工作.否则,请看这篇 jquerymobile.com文章.

but it should work. Otherwise take a look at this jquerymobile.com article.

这篇关于jQuery Mobile:如何使用动态DOM操作刷新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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