首先,我想说我真的很喜欢Scrollify,我现在正计划使用它。我的网站的想法是有一些具有快速滚动行为的部分和一些正常滚动的部分。一切都很好,除了我不想让它在从快照部分转到普通部分时进行快照滚动。就像现在一样,它会快速滚动到正常的部分,并且在它捕捉到之后,首先会进入正常的滚动。
换句话说,我认为我想要的是能够根据视口中的元素来控制何时启用捕捉滚动。不过,也许有一个更简单的解决方案。
你有什么意见建议?
发布于 2016-10-20 20:03:20
(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>所以我已经在尝试使用enable和disable方法,但是
发布于 2016-10-20 17:43:06
您可能需要使用禁用和启用方法来实现这一点。
https://stackoverflow.com/questions/40140204
复制相似问题