jQuery mobile .changePage无法正常工作 [英] jQuery mobile .changePage does not work properly

查看:172
本文介绍了jQuery mobile .changePage无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是一个用户登录屏幕,当登录成功时我想显示另一个页面,这个kinda有效,但成功登录后,我得到了两个页面的混合!它全部覆盖。所以只有当我刷新页面时,我才能正确地看到它。我也尝试使用jQuery版本1.6.4,但没有帮助。

 < script src =// ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery。 min.js>< /脚本> 
< script type =text / javascriptsrc =js / custom.js>< / script>
< script src =// code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js\"> ;</script>

< script>
$ .ajax({
...
成功:函数(数据){

$ .mobile.changePage('account.html');
},
});
< / script>

除了下一页的覆盖问题,还有一个JavaScript代码(b)

$ $ $ $($)
$(。infoBasic)。click(function(){
$(this).next('.infoDetails')。slideToggle(50);
});

});


解决方案

这里有几个问题: b
$ b

jQuery Mobile 1.1仅适用于核心jQuery版本1.6.4和1.7.1,而Mobile 1.2适用于核心版本1.7.0和1.8.2

$(document).ready()不受支持。改为使用 $(document).bind('pageinit')>。 http://jquerymobile.com/demos/1.2.0/docs/api /events.html



您的脚本引用不应以 // 开头,但 http://


This is a user login screen, when login successful I want to show another page, this "kinda" works but after successful login I get a mixture of both pages! it is all overlayed. So only when I refresh the page I can see it properly. I also tried to use jQuery version 1.6.4 but didn't help.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
<script src="//code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.js"></script>

<script>
   $.ajax({
   ...
   success: function (data){ 

      $.mobile.changePage('account.html'); 
 },
    });
</script>

Also apart from overlay issue on the next page there is a JavaScript code which does not work until I refresh the page.

  $(document).ready(function() {

    $(".infoBasic").click(function() {
     $(this).next('.infoDetails').slideToggle("50");
 });

}); 

解决方案

A couple of issues here:

jQuery Mobile 1.1 only work with core jQuery verysions 1.6.4 and 1.7.1 while Mobile 1.2 works with core 1.7.0 and 1.8.2

$(document).ready() is not supported. Use $(document).bind('pageinit') instead. http://jquerymobile.com/demos/1.2.0/docs/api/events.html

Your script references should not start with // but http://

这篇关于jQuery mobile .changePage无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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