我有一个我正在开发的网站,我在其中一个网页上使用Scrollify。特别是我的项目部分。
在我访问Project页面之前,所有页面都正常工作。在那之后,它们都不再滚动。项目页面继续正常工作,但其他人不会'滚动直到我刷新......即使这样,它们也只能重新访问项目页面。
我很确定它与SmoothState.js的实现有关...
有关如何减轻这种情况的任何想法?
我的Scrollify代码:
$(function() {
$.scrollify({
section : ".project",
scrollbars: false,
setHeights: false,
offset: -100,
updateHash: false,
before: function (i, panels) {
var ref = panels[i].attr("data-section-name");
$(".project.actived").removeClass("actived");
$("[data-section-name="+ref+"]").addClass("actived");
var ref = panels[i].attr("data-section-name");
$(".pagination .active").removeClass("active");
$(".pagination").find("a[href=\"#" + ref + "\"]").addClass("active");
}
$(".pagination a").on("click",$.scrollify.move);
});
我的SmoothState代码:
$( function() { // Ready
addBlacklistClass();
addScrollify();
var settings = {
anchors: '.menu-primary-menu-container ul li a, .logo-container a, .card-container .posts-pagination a, .card-container .card a, .post-nav a ',
blacklist: '.wp-link',
prefetch: true,
cacheLength: 2,
scroll: true,
onStart: {
duration: 280, // ms
render: function ( $container ) {
$container.addClass( 'slide-out' );
$('html, body').animate({ scrollTop: 0 }, 500);
}
},
onAfter: function($container) {
$container.removeClass( 'slide-out' );
addBlacklistClass();
addFlickity();
addScrollify();
$(function() {
var div = $('.image-container');
var width = div.width();
div.css('height', width);
});
videojs(document.getElementById('my_video_1'), {}, function(){
// Player (this) is initialized and ready.
});
var $hash = $( window.location.hash );
if ( $hash.length !== 0 ) {
var offsetTop = $hash.offset().top;
$( 'body, html' ).animate( {
scrollTop: ( offsetTop - 60 ),
}, {
duration: 280
} );
}
}
};
$( '#page' ).smoothState( settings );
} );