JQM-JQuery Mobile 1.4.2无限刷新,这是一个错误吗? [英] JQM - JQuery Mobile 1.4.2 infinite refresh, is it a bug?

查看:130
本文介绍了JQM-JQuery Mobile 1.4.2无限刷新,这是一个错误吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找不到有关此问题的任何人的任何其他信息...我在任何地方都没有使用.page(),甚至取消了我的外部javascript文件的链接,而且这种情况仍然会发生.

I couldn't find any other info about anyone with this problem... I am not using .page() anywhere, i even unlinked my exterenal javascript file, and it still happens.

我使用导航栏导航,并且随机(并非总是如此)它将开始无限循环地重新加载页面.并且有这1页,如果我按f5重新加载它,没有什么特别的,总会发生,但是如果我来自另一页...那么它不会发生o太奇怪了.

I navigate using a navbar and randomly (not always) it will start reloading the page in an infinite loop. and there is this 1 page, that has nothing special that will always happen if i press f5 to reload it, but if i come from another page... it doesnt happen o O it's so weird.

我正在将php和jqm 1.4.2与jquery 1.10.2一起使用.我会发布代码,但无法真正查明任何内容.

I'm using php and jqm 1.4.2 with jquery 1.10.2. I would post code, but can't really pinpoint anything.

在我可以按f5/refresh的页面上,它始终会出现此错误,我尝试删除所有内容和php,但包括include/header/footer的部分除外,但它仍然会发生..,从中删除了我的js标头,它仍然会发生,我唯一能得出的结论是jqm 1.4.2 jquery或我的php设置,我对如何做一无所知.任何的想法?该站点以前在jqm 1.2.0中,因此不记得遇到此问题.

On the page that i can press f5/refresh and it always does this bug, i tried removing all content, and php, other than includes/header/footer partials and it still happens...., removing my js from header and it still happens, the only conclusion I can come to is jqm 1.4.2 jquery or my php settings, which i am clueless on what to do. Any idea? This site used to be in jqm 1.2.0 and don't remember having this problem then.

似乎删除_footer.php部分已停止了它的内容的错误:

It seems removing the _footer.php partial stopped the bug this is its contents:

<?php
$navCSS = "ui-btn-active ui-state-persist";
?>
<div data-role="footer" data-position="fixed" data-tap-toggle="false">
    <div data-role="navbar" data-iconpos="top">
        <ul>
            <li><a href="quarts.php" class="cui-icon ui-nodisc-icon <?php echo($pageID == "quarts")?$navCSS:""; ?>" data-icon="quarts" data-prefetch="true" data-transition="fade">Quarts</a></li>
            <li><a href="nouvelle.php" class="cui-icon ui-nodisc-icon <?php echo($pageID == "nouv")?$navCSS:""; ?>" data-icon="nouv" data-prefetch="true" data-transition="fade">Nouvelle</a></li>
            <li><a href="disponible.php" class="cui-icon ui-nodisc-icon <?php echo($pageID == "disponible")?$navCSS:""; ?>" data-icon="dispo" data-prefetch="true" data-transition="fade">Dispo.</a></li>
            <li><a href="paies.php" class="cui-icon ui-nodisc-icon <?php echo($pageID == "paie")?$navCSS:""; ?>" data-icon="paie" data-prefetch="true" data-transition="fade">Paies</a></li>
            <li><a href="#pushMenu" id="push" class="cui-icon ui-nodisc-icon <?php echo($pageID == "code" || $pageID == "docs" || $pageID == "profil")?$navCSS:""; ?>" data-icon="autre" data-transition="slide">Autres...</a></li>
        </ul>
    </div>
</div>

<!-- page end -->
</div>
</body>
</html>

删除数据预取可解决此问题,但我想预取页面以实现流畅的导航并使它感觉像一个应用程序,为什么会导致此问题?

removing data-prefetch stops the issue, but i wanted to prefetch pages for smooth navigation and make it feel like an app, why does it cause this issue?

推荐答案

外部页面/链接被预取多次,因为您内部分别使用相同的 navbar 页.您的解决方案是使用外部页脚和 navbar ,可以从任何内部或外部页面访问该

External pages/links are being prefetched several times as you are using the same navbar internally for each page. Your solution is to use an External footer and navbar which can be accessed from any internal or external page.

<body> <!-- or page container div -->
  <div data-role="page">
  </div>

  <!-- external footer -->
  <div data-role="footer" data-theme="a">
     <div data-role="navbar">
     </div>
  </div>

在使用外部小部件时,您需要通过调用.toolbar()手动初始化它们,然后先.enhanceWithin()初始化内部小部件.

When using external widgets, you need to initialize them manually by calling .toolbar() and then .enhanceWithin() to initialize inner widgets.

$(function () {
  $("[data-role=footer]").toolbar().enhanceWithin();
});

这篇关于JQM-JQuery Mobile 1.4.2无限刷新,这是一个错误吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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