【问题标题】:normalScrollElements in fullpage.js does not accept multiple selectorsfullpage.js 中的 normalScrollElements 不接受多个选择器
【发布时间】:2018-04-09 23:07:38
【问题描述】:

normalscrollElements 下的fullpage.js spec 中,它声明我可以将X 编号的JQuery 选择器列为逗号分隔的字符串。

这就是我目前的配置方式:

 $('#fullpage_2').fullpage({
  anchors:['info', 'lists', 'activity','stats','valorations','forum-stats'],
  menu: '#fp-nav',

  scrollingSpeed: 700,
  normalScrollElements: '#prueba6, #searchbox',

  scrollOverflow:true,
  afterLoad: function(anchorLink, index){
    var loadedSection = $(this);

    console.log("el indice es: "+index);

    //using anchorLink

  }

});

但是它不适用于多个选择器。奇怪的是,我可以输入下面的代码并且它可以工作:

normalScrollElements: '#prueba6',

或者我可以说:

normalScrollElements: '#searchbox',

但只要我将两者放在一起,normalScrollElements: '#prueba6, #searchbox',它只适用于第一个元素 (#prueba6)。如何绑定多个元素?

【问题讨论】:

  • 根据规范,您的实现是正确的。 normalScrollElements: (default null) If you want to avoid the auto scroll when scrolling over some elements, this is the option you need to use. (useful for maps, scrolling divs etc.) It requires a string with the jQuery selectors for those elements. ** (For example: normalScrollElements: '#element1, .element2'). ** This option should not be applied to any section/slide element itself. github.com/alvarotrigo/fullPage.js.
  • 是的,我知道我遵循了指南,但问题只适用于一个元素。如果明天我想将#prueba7 添加到以下元素中,我只能选择一个
  • 您是否遇到任何控制台错误?
  • Nop 0。只有我在 prueba6 之前放置的第一个元素起作用,而不是搜索框。如果我放在搜索框之前,请不要使用 prueba6。但不是同时。但是任何控制台错误。

标签: javascript angular frontend fullpage.js


【解决方案1】:

按预期完美运行。看这个演示:https://jsfiddle.net/5yLsdwmt/22/

$('#fullpage').fullpage({
    sectionsColor: ['yellow', 'green', 'purple', 'orange'],
  normalScrollElements: '#demo1, #demo2'
});

你可能做错了什么。但由于您没有提供单独的复制品,我们无法为您提供帮助。

阅读本主题应该可以帮助您解决问题 :) https://alvarotrigo.com/blog/how-not-suck-at-asking-coding-questions/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-03
    • 2019-12-12
    相关资源
    最近更新 更多