在jQuery开发环境下:
1.滚轮事件:(需要监听mousewheel DOMMouseScroll)
//代码 只是我拷贝的 代码片段
$(document).on("mousewheel DOMMouseScroll", function(e)
{
console.log('mousewheel');
if(_this.switch)
{
_this.switch = false;
var delta = (e.originalEvent.wheelDelta && (e.originalEvent.wheelDelta > 0 ? 1 : -1)) ||
(e.originalEvent.detail && (e.originalEvent.detail > 0 ? -1 : 1));
if(delta > 0)
{
_this.index = _this.index - 1;
_this.index = Math.max(_this.index, 0);
_this._move(_this.index)
}
else if(delta < 0)
{
_this.index = _this.index + 1;
_this.index = Math.min(_this.index, _this.listLength - 1);
_this._move(_this.index);
}
}
});
2.PC鼠标滑动(我的业务需求只是需要判断鼠标按下和抬起 Y坐标变化 mousedown mouseup)
//代码 只是我拷贝的 代码片段
$(document).stop().on("mousedown", function(e)
{