簡單的滑鼠滾輪事件

2022-01-11 08:03:18 字數 378 閱讀 2315

function addevent(obj,xevent,fn) else

}window.onload = function ()

}

下面這個是借鑑的張鑫旭大神的思路

woo就是擁有2000px的內容

以下就是簡單的滾動滾輪事件了,但是呢,在兩大陣營瀏覽器中乙個是120的乙個3的,所以速度上不統一,那看張鑫旭大神是怎樣做的。

document.body.onmousewheel = function(event) ;

document.body.addeventlistener("dommousescroll", function(event) );

滑鼠滾輪事件

新增事件 有相容性 註冊事件 if document.addeventlistener window.onmousewheel document.onmousewheel scrollfunc ie opera chrome detail與wheeldelta 判斷滾輪向上或向下在瀏覽器中也有相容性...

滑鼠滾輪事件

新增事件 有相容性 註冊事件 if document.addeventlistener window.onmousewheel document.onmousewheel scrollfunc ie opera chrome detail與wheeldelta 判斷滾輪向上或向下在瀏覽器中也有相容性...

滑鼠滾輪事件

滑鼠滾輪事件和鍵盤事件以及滑鼠左右鍵沒本質的區別。2 if document.addeventlistener window.onmousewheel document.onmousewheel scroll ie opera chrome safari 像上面這樣就可以給整個文件繫結滾輪事件。fu...