jquery-mobile-后退按钮双后退-仅限Android [英] jquery-mobile - back button double back - Android only

查看:126
本文介绍了jquery-mobile-后退按钮双后退-仅限Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与data-rel ="back"的链接会导致两次(两次)向后转换,而不是一次.这个问题似乎与Android有关-在2.2和2.3中得到了证明.

Link with data-rel="back" causes two (double) back transitions instead of a single. The issue seems to be Android related - demonstrated in 2.2 and 2.3.

第1页->第2页->第3页

page 1 -> page 2 -> page 3

如果用户单击第3页的后退链接,则会发生以下情况: 反向链接->(第2页温度)->第1页

If the user clicks the back link on page 3 the following will happen: back link -> (page 2 temp) -> page 1

尝试禁用pushStateEnabled失败

Attempted to disable pushStateEnabled without success

<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script>
$( window ).bind( 'mobileinit', function(){
    $.mobile.pushStateEnabled = false;
});
</script>
<script src="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>

也尝试过并保持双后退

<a href="/" onclick="history.back(-1)" >Back</a>

是否有任何建议/更新以提供预期的功能?

Any suggestions/update to deliver expected back functionality?

推荐答案

只要您的锚标记正确,我就不会理解为什么$.mobile.pushStateEnabled = false;无法正常工作.

As long as your anchor tags are correct I don't see why $.mobile.pushStateEnabled = false; does not work.

也许可以使用文档"代替窗口"作为选择器.

Maybe using 'document' as your selector instead of 'window' will do the trick.

您尝试了吗?

<script>
$( document ).bind( 'mobileinit', function(){
    $.mobile.pushStateEnabled = false;
});
</script>

这篇关于jquery-mobile-后退按钮双后退-仅限Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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