1

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 );
} );
  • 1
    Welcome to StackOverflow! In order for us to help you better, please update your question so that it shows all relevant code in a [minimal, complete, and verifiable example](http://stackoverflow.com/help/mcve). Also be sure to let us know what you have tried so far to solve your problem. For further information, please refer to the [help article](http://stackoverflow.com/help/how-to-ask) regarding how to ask good questions. – Obsidian Age Feb 03 '17 at 00:59

0 Answers0