如果有一段时间讨厌IE,就是这样。此代码以包含内容的框开头。点击该按钮时,该框应该放下并淡入。如何使这个jQuery代码片段在Internet Explorer中工作?
<html>
<script type="text/javascript" src="jquery.js"></script>
<script type='text/javascript'>
function Test()
{
var item_height = $('#test').height();
$('#test').height(0);
$('#test').css('opacity','0');
$('#test').animate({ height: item_height, opacity: '1' },400);
}
</script>
<body>
<!-- The div below holds the sample content -->
<div id="test" style='border: 1px solid black;'>
Content<br>
Content<br>
Content<br>
Content<br>
Content
</div>
<!-- The button to test the animation -->
<br><br>
<div style='position: absolute; top: 150px; left: 10px;'>
<button onclick='Test();'>Test</button>
</div>
</body>
</html>
这个非常简单的例子适用于Chrome,Safari和Opera。但Internet Explorer? 否。
我怎么能(如果它甚至可能)解决这个问题,以便它在IE中工作?
什么情况或不会发生?您在哪些IE中测试过它?您是否尝试添加所需的'
'标签? – 2010-04-21 22:00:09猜测我只是忽略了这些,因为我认为它们并不重要。忘记DOCTYPE。 – 2010-04-21 22:30:39