【问题标题】:How to make scrolling parallax with one movement with scroll mouse如何使用滚动鼠标一次移动滚动视差
【发布时间】:2012-12-25 11:37:10
【问题描述】:

我有问题。我需要像http://community.saucony.com/kinvara3/ 这样的视差。我知道如何制作视差,但不是只用鼠标滚动一次。

从卷轴移动一次,卷轴直线运行。

【问题讨论】:

标签: jquery scroll mouse parallax


【解决方案1】:

您应该在触发滚动时临时禁用滚动。

function disable_scroll() {
  if (window.addEventListener) {
      window.addEventListener('DOMMouseScroll', wheel, false);
  }
  window.onmousewheel = document.onmousewheel = wheel;
  document.onkeydown = keydown;
}

function enable_scroll() {
    if (window.removeEventListener) {
        window.removeEventListener('DOMMouseScroll', wheel, false);
    }
    window.onmousewheel = document.onmousewheel = document.onkeydown = null;  
}

【讨论】:

  • 嗯,好的,但接下来我该怎么做?我正在尝试使用 MouseWheel (jQuery) 但没有成功:(
猜你喜欢
  • 2011-09-29
  • 2013-12-30
  • 1970-01-01
  • 1970-01-01
  • 2020-09-19
  • 1970-01-01
  • 2013-11-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多