日期:2014-05-17  浏览次数:20410 次

鼠标滚轮事件怎么写?
function move(){}

function over(){}

  function wheel(event) {
  var delta = 0;
  if (!event) event = window.event;
  if (event.wheelDelta) {
  delta = event.wheelDelta / 120;
  if (window.opera) delta = -delta;
  } else if (event.detail) {
  delta = -event.detail / 3;
  }
  if (delta < 0)
  over();
  else 
  move();
   
  }
  if (window.addEventListener)
  window.addEventListener('DOMMouseScroll', wheel, false);
  window.onmousewheel = document.onmousewheel = wheel;


这样写 over 和 move 能执行吗?

------解决方案--------------------
自己试试啊
参考 http://www.cnblogs.com/rubylouvre/archive/2010/05/01/1725462.html