关闭jQuery Mobile新弹出窗口导致页面无用刷新 [英] Closing jQuery Mobile new popup cause page to refresh uselessly

查看:121
本文介绍了关闭jQuery Mobile新弹出窗口导致页面无用刷新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有1.2.0 alpha版本的新jqm弹出窗口,我的问题是,使用esc键或单击屏幕关闭弹出窗口时,我调用该弹出窗口的页面无用地刷新了.刷新仅在我第一次关闭时发生.如果我重新打开并再次关闭弹出窗口,则页面不会刷新...

I'm using the new jqm popup with the 1.2.0 alpha release and my problem is that my page from which I call the popup is refreshed uselessly when closing the popup using esc key or clicking on the screen... This refresh happen only the first time I close it. If I reopen and close again the popup the page is not refreshed...

似乎出于某种原因,jqm历史机制被弄乱了....

It seems that for some reason jqm history mecanism get messed up....

它似乎不是内置功能,因为jqm演示页面中的任何弹出窗口都不会发生这种情况.

It don't seem to be a built-in feature because this does not happen for any popup in the jqm demo page.

有什么办法解决这个问题吗?

Any idea how to solve this issue?

谢谢

艾蒂安

推荐答案

根据我的评论,这是该问题的临时解决方法.只需适当地绑定到导航事件并调用preventDefault.这将防止重新加载页面.我只有在打开popupafterclose之后才绑定它:

Per my comment, here's a temporary workaround to the issue. Just appropriately bind to the navigate event and call preventDefault. This will prevent the reloading of the page. I ended up binding to the popupafterclose, only when it's been opened:

  $('.my-popup-selector').on('popupafteropen', function () {
      $(this).one('popupafterclose', function () {
          $(window).one('navigate.popup', function (e) {
              e.preventDefault();
          });
      });
  });

这篇关于关闭jQuery Mobile新弹出窗口导致页面无用刷新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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