在IE8中,toggle kinda可以工作,但覆蓋了下面的內容。它可以在所有其他瀏覽器中正常工作。我一直試圖在過去的2個小時解決這個問題,但沒有運氣....toggle在IE8中無法正常工作
jQuery的:
$(document).ready(function() {
$('.toggle').hide();
$('.expand-all').click(function(){
// switch visibility
$(this).data('is_visible', !$(this).data('is_visible'));
// change the link depending on whether the element is shown or hidden
$(this).html((!$(this).data('is_visible')) ? 'Expand all' : 'Hide');
$(this).next().toggle();
return false;
});
});
HTML:
<div id="categories">
<div class="cat">
<h3>Rice</h3>
<ul>
<li><a href="">Rice brand 1</a></li>
<li><a href="">Rice brand 2</a></li>
<li class="expand-all">Expand all</li>
<div class="toggle">
<li><a href="">Rice brand 1</a></li>
<li><a href="">Rice brand 1</a></li>
</div>
</ul>
</div>
<div class="cat">etc</div>
<div class="cat">etc</div>
<div class="cat">etc</div>
</div>
該示例頁面的javascript控制檯指示jquery未被加載。你的JS資源的URL是'tangola1.local'。 – 2012-01-11 20:34:41
對不起,jquery文件在本地加載。它應該在Chrome/Firefox中工作 – Cris 2012-01-11 20:37:08
在IE8中適合我。也許你應該描述你所看到的問題。 – 2012-01-11 20:39:39