【发布时间】:2015-09-24 03:07:43
【问题描述】:
我为div:target 写了一些特殊的样式。当我点击<a href="#target"> 时,Chrome、Firefox 和 IE9+IE11 运行良好。现在我单击“返回”按钮(或“javascript: history.go(-1)”),我的 URL 栏立即返回,但 IE 拖着脚回到默认样式,有时需要 3-5 秒,有时它不会更新 ,直到我按下 F12 并尝试检查有问题的元素(然后它会立即更新)。什么给了?
更新:这似乎只发生在 IE11 中。使用(本机安装)IE9 的每个人都没有问题。即使用 IE11 模拟 IE9 也会有问题。
http://jsfiddle.net/r1rqp1sc/2/:
$('#hello').click(function(){
history.go(-1);
});
div {
width: 100px; height: 100px;
background: gray; color: white;
cursor: pointer;
}
div:target { background: red; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<a href="#hello">Hello</a>
<div id="hello">Click here to go history:back()</div>
【问题讨论】:
标签: css internet-explorer browser-history pseudo-class