日期:2014-05-17 浏览次数:20992 次
$(document).ready(function(){
$("#svglocation").mouseenter(function()
{
var scrollFunc=function(e){
var direct=0;
e=e || window.event;
if(e.wheelDelta){//IE/Opera/Chrome
userMouse(e.wheelDelta);
}else if(e.detail){//Firefox
userMouse(e.wheelDelta);
}
};
//alert("Code implement here-------------------");
/*注册事件*/
if(document.addEventListener){
document.addEventListener('DOMMouseScroll',scrollFunc,false);
}//W3C
//window.onmousewheel=document.onmousewheel=scrollFunc;//IE/Opera/Chrome/Safari
window.onmousewheel != document.onmousewheel;
document.onmousewheel=scrollFunc;
//自己的函数
function userMouse(flage){
if(flage == 3){
alert("firefox下鼠标向上滚动!");
}else if(flage == -3){
alert("firefox下鼠标向下滚动!");
}else if(flage == 120){
alert("IE下鼠标向上滚动!");
}else if(flage == -120){
alert("IE下鼠标向下滚动!");
}
}
});
$("#svglocation").mouseleave(function(){
//alert("2");
});
});