Fullpage.js disable vertical scroll on section

断了今生、忘了曾经 提交于 2019-12-13 19:09:08

问题


I require one section to be "hidden". As i have links that "silentMove" to the slides in the section.

I have tried to use the following with no luck data anchor is "investments":

afterLoad: function(anchorLink, index){
if(index == 4 && slideAnchor == 'investments'){
$('body.fp-section.investments').find('.fp-slide').index(4,0);
    $.fn.fullpage.setAllowScrolling(false, 'down'); 
    $.fn.fullpage.setKeyboardScrolling(false, 'down');
}
},

Only solution i could come up with was:

    afterLoad: function(anchorLink, index){
    if(index == 4 && anchorLink == 'investment'){
    $('body.fp-viewing-investment').find('.fp-section').index();
        $.fn.fullpage.setAllowScrolling(false, 'down'); 
        $.fn.fullpage.setKeyboardScrolling(false, 'down');
    }
  if(index == 3 && anchorLink == 'section3'){
    $('body.fp-viewing-section3').find('.fp-section').index();
        $.fn.fullpage.setAllowScrolling(true, 'down'); 
        $.fn.fullpage.setKeyboardScrolling(true, 'down');
    }

This is a shorter code, but you can not leave section 5, once you enter with silent move to:

    afterLoad: function(anchorLink, index){
    document.body.style.overflow = "hidden";
  document.body.className += " no-scroll";}

https://jsfiddle.net/4wvwjrta/6/

来源:https://stackoverflow.com/questions/50228319/fullpage-js-disable-vertical-scroll-on-section

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!