search

Home  >  Q&A  >  body text

javascript - 页面没有滚动条如何去触发scroll事件

诸如小米手机的展示页面小米手机展示页

阿神阿神2903 days ago349

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-10 15:09:39

    jsvar MouseWheelHandler = function(e) {
          e.preventDefault();
          e = window.event || e;
          //do something here
    }
    /*
    refer to fullpage.js
    github: https://github.com/alvarotrigo/fullPage.js
    */
    var addMouseWheelHandler = function() {
      document.addEventListener("mousewheel", MouseWheelHandler, false); 
      //IE9, Chrome, Safari, Oper
    }
    addMouseWheelHandler();
    

    这是参考fullpage.js写的
    简单来说就是添加鼠标滚轮滚动事件

    reply
    0
  • PHP中文网

    PHP中文网2017-04-10 15:09:39

    监听mousewhell事件就可以了,小米用的jquery.mousewhell插件

    reply
    0
  • Cancelreply