問題描述
Jquery、Javascript 點擊菜單在 IE 和 Safari 上不起作用 (Jquery, Javascript click menu doesnt work on IE and Safari)
我創建了這個小菜單 demo,它在 firefox 和 Chrome 上運行良好。但是函數 (".class").cick(function() 在 IE 和 Safari 上什麼都不做。也許有人可以幫忙?我試過 .live .on("click",".class") 等等。沒有任何效果. 你需要像 這個
代碼(Javascript)
/*Desktopvariante*/
if ((($(window).width() > 970) && test == 90) || (($(window).width() > 970))) {
$(function () {
$(".ClickLevel1").click(function () {
$(this).addClass("activeFarbe");
$(".navLevel1").addClass("activePfeil", 400);
$("#listLevel1").show("slide", {direction: "right"}, 350);
return false;
});
});
$(function () {
$(".ClickLevel2").click(function () {
$(this).addClass("activeFarbe");
$(".navLevel2").addClass("activePfeil",400);
$("#listLevel2").show("slide", {direction: "right"}, 350);
return false;
});
});
$(function () {
$(".ClickLevel3").click(function () {
$(this).addClass("activeFarbe");
$(".navLevel3").addClass("activePfeil",400);
$("#listLevel3").show("slide", {direction: "right"}, 350);
return false;
});
});
}
}
參考解法
方法 1:
problem solved (screen.orientation.angle) cant be read by safari and IE