jQuery Mobile页面刷新机制 [英] jQuery Mobile Page refresh mechanism

查看:198
本文介绍了jQuery Mobile页面刷新机制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在了解jQuery Mobile如何处理ajax更新后的页面刷新时,我感到非常痛苦.

我有两个页面-唯一的文件站点:一个搜索引擎.

第一页是搜索字段.提交会触发JSON调用和解析器,从而更新第二页:结果.

现在我正在使用:$.mobile.changePage( $('#result') );可以很好地完成从搜索字段到结果页面的工作. 然而: 如果我从结果页面中将其重用于下一个/上一个页面(新的json调用,新的解析,DOM中新添加的节点); jQuery Mobile只是不绘制"新添加的节点.

任何人都可以解释,请使用和区分 1- $.mobile.page() 2- $.mobile.changePage() 3- $.mobile.refresh()

或提示我如何处理页面更改. 谢谢!

解决方案

function refreshPage()
{
    jQuery.mobile.changePage(window.location.href, {
        allowSamePageTransition: true,
        transition: 'none',
        reloadPage: true
    });
}

来自此处

can anyone explain, please the use and distinction of 1- $.mobile.page() 2- $.mobile.changePage() 3- $.mobile.refresh()

or give me a hint on how I should handle page changes. thanks!

解决方案

function refreshPage()
{
    jQuery.mobile.changePage(window.location.href, {
        allowSamePageTransition: true,
        transition: 'none',
        reloadPage: true
    });
}

Taken from here http://scottwb.com/blog/2012/06/29/reload-the-same-page-without-blinking-on-jquery-mobile/ also tested on jQuery Mobile 1.2.0

这篇关于jQuery Mobile页面刷新机制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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