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

查看:21
本文介绍了关闭 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天全站免登陆