事件型別
事件物件
是否標準化
相容性mousewheel
mousewheelevent
非標準化
只有firefox不支援
dommousescroll
mousescrollevent
非標準化
只有firefox支援
wheel
wheelevent
dom level 3
firefox 17+/ie9+
wheel事件詳細內容:wheel事件
瀏覽器型別
evt.wheeldelta
evt.detail
safari v5/win7
1200
safari v5/os x
1200
safari v7/os x120
chrome v11/win7
1200
chrome v37/win7
1200
chrome v11/os x
3(!)
0(possibly wrong)
chrome v37/os x
1200
ie9/win7
120undefined
opera v11/os x
40-1
opera v24/os x
1200
opera v11/win7
120-3
firefox v4/win7
undefined
-3firefox v4/os x
undefined
-1firefox v30/os x
undefined
-1
'use strict';
var useragent_deprecated = require('useragent_deprecated');
var iseventsupported = require('iseventsupported');
// reasonable defaults
var pixel_step = 10;
var line_height = 40;
var page_height = 800;
function normalizewheel(event)
if ('wheeldelta' in event)
if ('wheeldeltay' in event)
if ('wheeldeltax' in event)
// side scrolling on ff with dommousescroll
if ( 'axis' in event && event.axis === event.horizontal_axis )
px = sx * pixel_step;
py = sy * pixel_step;
if ('deltay' in event)
if ('deltax' in event)
if ((px || py) && event.deltamode) else
} // fall-back if spin cannot be determined
if (px && !sx)
if (py && !sy)
return ;
}/*spinx + spiny標準化的最佳組合。 它支援舊的dommousescroll for firefox,因為ff不包含帶有'wheel'事件的wheeldelta,因此無法確定旋轉速度。*/
normalizewheel.geteventtype = function() /*string*/ ;
module.exports = normalizewheel;
滑鼠滾輪事件
新增事件 有相容性 註冊事件 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...