I have a website I'm currently developing and I'm using Scrollify for one of the pages. In particular, my project sections.
All the pages work fine until I visit my Project page. After that, none of them scroll anymore. The project page continues to work fine, but the others wont' scroll until I refresh... And even then, they only work until I re-visit the project page.
I'm pretty sure it has something to do with the implementation of SmoothState.js...
Any ideas on how to mitigate this?
My Scrollify Code:
$(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);
});
My SmoothState Code:
$( 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 );
} );