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

查看:22
本文介绍了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: 真,过渡:'无',重新加载页面:真});}

取自这里 http://scottwb.com/blog/2012/06/29/reload-the-same-page-without-blinking-on-jquery-mobile/ 也在 jQuery Mobile 1.2.0 上测试>

I'm having a lot of pain understanding how jQuery Mobile handles pages refresh after an ajax update.

I'm having a two pages - unique file site: a search engine.

First page is a search field. Submit triggers a JSON call and parser which updates the second page: results.

for now i'm using: $.mobile.changePage( $('#result') ); which does the job great from search field to result page. However: If I reuse it from result page for next/prev pages ( new json call, new parse, new added nodes in the DOM ); Jquery Mobile just don't "paint" the newly added nodes.

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天全站免登陆