【发布时间】:2012-06-19 03:12:41
【问题描述】:
我在这里运行了一个测试:http://raglefant.com/test.php 我在标题中有这个 jQuery:
$(document).ready(function() {
$('#hideable_header').stop().delay(2000).animate(
{marginTop: '-=290'}
,1000,function() {
});
$('#hideable_header').click(function() {
var position = parseInt($("#hideable_header").css("margin-top"),10);
console.log('Position: ' + position);
if (position == 0)
{
$('#hideable_header').stop().animate(
{marginTop: '-=290'}
,1000,function() {
});
}
else
{
$('#hideable_header').stop().animate(
{marginTop: '+=290'}
,1000,function() {
});
}
});
});
这是 div:
<div id="hideable_header" style="position:fixed; top: 0; left: 0; width: 100%; height: 300px; background: #000; z-index:9999;"></div>
这在 Chrome 中运行良好,但在 IE9 中不行。如果我单击 DIV,它应该更改 margintop 以隐藏或显示 DIV,但在 IE9 中没有任何反应。 如果我在 IE9 中打开 devtools,一切正常,没有出现任何错误。但是当我关闭页面并再次打开它时,它仍然失败。
有什么想法吗?
【问题讨论】:
标签: jquery internet-explorer-9