整页.js滚动滑块

fullpage.js scrolling the sliders

本文关键字:滚动 js 整页      更新时间:2023-09-26

刚开始使用fullPage.js。我在练习中写了一些滑块,发现滑块滚动无法由鼠标滚轮控制。阅读帮助文档 (https://github.com/alvarotrigo/fullPage.js),但仍然没有找到任何参数可以提供帮助。那么谁能给我一些关于如何解决这个问题的建议?

法典:

 $(function () {
  $("#dowebok").fullpage({
    verticalCentered: false,
    anchors: ['page1', 'page2', 'page3', 'page4'],
    navigation: true,
    navigationTooltips: ['1', '2', '3', '4'],
  });
});

问题解决了,代码如下:

 $('.slider-section').bind('mousewheel DOMMouseScroll', function (e) {
    if (e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0) {
      if (!$('.first-slide').hasClass('active')) {
        $.fn.fullpage.moveSlideLeft();
      } else {
        $.fn.fullpage.moveSectionUp();
      }
    } else {
      if (!$('.last-slide').hasClass('active')) {
        $.fn.fullpage.moveSlideRight();
      } else {
        $.fn.fullpage.moveSectionDown();
      }
    }
    return false;
  });
$('.slider-section').bind('mousewheel DOMMouseScroll', function(e){
    if(e.originalEvent.wheelDelta > 0 || e.originalEvent.detail < 0){
        $.fn.fullpage.moveSlideLeft();   
    }else{
         $.fn.fullpage.moveSlideRight();
    }
    return false;
});

它在 chrome 中工作,以便在您需要禁用整页的其他浏览器中工作.js滚动

$.fn.fullpage.setAllowScrolling(false);

但是你不能把它设置在afterLeaveonLoad事件中,但它是你如何做到这一点的起点。