1

首先我想说我真的很喜欢 Scrollify,我现在正计划使用它。我的网站的想法是让一些部分具有快速滚动行为和一些具有正常滚动行为的部分。一切正常,除了我不希望它在从快照部分转到普通部分时进行快速滚动。因为它现在是捕捉滚动到正常部分,并且在捕捉后首先进入正常滚动。

换句话说,我认为我正在寻找的是能够根据视口中的元素控制何时启用快速滚动。也许有一个更简单的解决方案。

你有什么建议吗?

4

2 回答 2

1
(function() {
  var firstSection = $('.wrapper .normal-page').eq(0)[0]
  var firstSectionClassName = $(firstSection).attr('class')
  var base = this;

  $.scrollify({
    section : ".product-page",
    sectionName : "section-name",
    interstitialSection : ".normal-page",
    easing: "easeOutExpo",
    scrollSpeed: 1100,
    offset : 0,
    scrollbars: true,
    standardScrollElements: ".normal-page",
    setHeights: true,
    overflowScroll: true,
    before:function(index, arr) {
      var currentItem = $.scrollify.current().attr('class')

      if (currentItem !== "product-page") {

        $.scrollify.disable();
      }

    },
    after:function() {

      $.scrollify.enable();
    },
    afterResize:function() {

    },
    afterRender:function() {
      console.log("move to the top")
      $.scrollify.instantMove("#" + firstSectionClassName)

    }
  });
})()

HTML

<body>
    <div class="wrapper">
      <div class="normal-page"></div>
      <div class="product-page"></div>
            <div class="normal-page"></div>
        <div class="product-page"></div>
        <div class="normal-page"></div>
    </div>
</body>

所以我已经在尝试启用和禁用方法,但是

于 2016-10-20T12:03:20.123 回答
0

您可能需要使用 disable 和 enable 方法来实现这一点。

于 2016-10-20T09:43:06.027 回答