jQuery历史后退按钮重置 [英] jquery history back button to reset

查看:144
本文介绍了jQuery历史后退按钮重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站有问题.当发生重定向以获取页面之间的过渡效果时,我有一些动画.问题在于,如果用户单击浏览器后退"按钮,它将跳至上一页,但不会重置动画,因此所有内容都像退出页面时一样保持隐藏状态.

I am having a problem with my website. I have some animations when a redirect is happening to get a transition effect from page to page. The problem is that if a user clicks the Browsers Back button it goes to the previous page but it does not reset the animations so everything stays hidden as when you exited the page.

要演示该错误,请访问 http://www .econtentsys.gr/affiliate/xenosk/temp/amigdalos/main.php ,单击关于我",然后单击浏览器(历史记录)后退"按钮.

To have a demo of the error go to http://www.econtentsys.gr/affiliate/xenosk/temp/amigdalos/main.php , Click on About Me and then click on your browsers (history) Back button.

是否总有要重置页面缓存的功能,可以说每次显示页面时都可以正常进行过渡?

Is there anyway to reset the pages cache lets say every time the page gets showed so the transitions will always work ?

只有Google Chrome浏览器可以正常运行.所有其他浏览器都有相同的错误.

Only Google Chrome functions properly on me. All the other browsers are having the same error.

谢谢.

推荐答案

单击后退按钮时,您的动画不会重置,因为该页面已缓存在

Your animation doesn't reset when you click the back button because the page is cached in the bfcache (Back-Forward Cache).

链接的文章提到了不使用bfcache的几种情况,一种情况是使用unload处理程序时.因此,最简单的方法是将一个空的onunload属性简单地添加到您的<body>标签中,即

The linked article mentions several situations where bfcache is not used, one being when the unload handler is uses. Therefore, the simplest approach would be to simple add an empty onunload attribute to your <body> tag, i.e.

<body onunload="">

p.s.我仅在Firefox中对此进行了测试.

p.s. I've only tested this in Firefox.

这篇关于jQuery历史后退按钮重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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