-1
我在這裏有這個網站http://jamessuske.com/freelance/seasons/index.php,並在左側的導航欄中,我使用jQuery刪除一個類並將其添加到當前頁面上,如果您點擊Menu
鏈接它應該顯示一個子菜單。JQuery不能在IE 8或7中工作
<script type="text/javascript">
$('.navigation li a').each(function() {
$(this).removeClass('active');
});
$('.navigation li ul.menu-submenu').hide();
$('.navigation li a').eq(6).addClass("active");
</script>
上面是我在每個單獨頁面中更新導航的代碼。
在我的header.php文件,我有以下幾點:
<script type="text/javascript" src="js/jquery-2.0.3.min.js"></script>
<script type="text/javascript">
$(window).load(function() {
var theWindow = $(window),
$bg = $("#bg"),
aspectRatio = $bg.width()/$bg.height();
function resizeBg() {
if ((theWindow.width()/theWindow.height()) < aspectRatio) {
$bg.removeClass()
.addClass('bgheight');
} else {
$bg.removeClass()
.addClass('bgwidth');
}
}
theWindow.resize(resizeBg).trigger("resize");
});
</script>
請問這個爛攤子了我的導航?
header.php文件包含在所有使用php include的頁面中。
jQuery 2.x不再支持舊的IE版本。改爲使用jQuery 1.10.x。 –
AFAIK,jQuery 2不支持IE 7或8。 – Sparky
爲什麼當它已經發生時在窗口上觸發'resize'? – BenM