Iphone - Safari - detect swipe navigation

Nor*_*ern 5 javascript mobile-safari swipe-gesture

I'm having a bit of a problem with mobile safari's swipe animation:

I've created a popup window of sorts, for the search functionality (with a similar purpose and look to ebay's mobile site. Go to ebay on mobile, and focus on the search field and it will overlay a sort of popup over the entire site)

The difference, however, is that I've added a pushstate command so that when you open the search popup, it advances the browser history. That way, if a user wants hits "back" on the browser, it'll just close the popup instead of going to whatever previous page the user came from.

另一件事是我为窗口的出现和消失创建了动画。因此,当您专注于搜索字段时,弹出窗口会通过从右向左滑动来出现,并以类似的方式消失。

但问题是:iPhone 的滑动导航功能破坏了滑动效果 - 当您打开弹出窗口时,它会在浏览器的历史记录中向前推进。现在,如果您尝试使用滑动功能返回,它会显示上一页的滑动动画进入视图(iPhone 的默认设置),但是完成后,我的代码就会启动(因为最终,它会触发 popstate 事件) )并且还做了滑动动画,所以看起来很破碎。因此,结果是:您滑动返回上一页,其中显示搜索弹出窗口被推出视图(就像我的动画一样),然后当您完成后,繁荣,动画重新出现并再次播放。

理想情况下,我希望能够以某种方式检测滑动功能。也就是说,某些事件或 popstate 事件中的某些内容表明滑动导航正在发生或刚刚发生?

或者也许,能够禁用 safari 的默认效果?(我怀疑答案是否定的)

除了在检测到 Safari 时禁用自定义动画或取消 Pushstate 功能之外,我还能对这些内容做些什么吗?

任何有关解决方案的建议将不胜感激。