我的代码适用于Chrome和Firefox,但不适用于Safari。
这是一段代码:
var menu = document.getElementById("navigation1");
var already_moved = 0;
menu.onmouseover = function moveNavigation(menu) {
if (already_moved == 0) {
document.getElementById("navigation1").style.marginLeft = "0px";
already_moved = 1;
}
};
menu.onmouseleave = function moveBackNavigation(menu) {
if (already_moved == 1) {
//document.getElementById("navigation1").style.marginLeft = "-341px";
closeMenu();
already_moved = 0;
}
};
function closeMenu(){
setTimeout(function f(){
document.getElementById("navigation1").style.marginLeft = "-341px";
already_moved = 0;
}, 2000);
};
此代码将菜单向左和向后移动。 感谢您的任何想法 - 如何让它在Safari中运行。