miguel-perez / smoothState.js

Unobtrusive page transitions with jQuery.
MIT License
4.43k stars 508 forks source link

When I click on link I get blank page (the html code is there) #378

Open giacomomasseron opened 4 years ago

giacomomasseron commented 4 years ago

Hi, I do not why when i click on link I get blank page, even if the html code of the page is there. If I simply press F5 the page shows itself well.

I start the plugin with this code:

var smoothState = $('#page').smoothState(options).data('smoothState');

With these options:

var options = {
    prefetch: true,
    prefetchOn: 'mouseover',
    cacheLength: 100,
    scroll: true, 
    blacklist: '.default-link' && '.show-gallery',
    forms: 'contactForm',
    onStart: {
        duration:210, // Duration of our animation
        render: function ($container) {
        $container.addClass('is-exiting');// Add your CSS animation reversing class
            $('.menu, .menu-hider').removeClass('menu-active');
            $('.loader-main').removeClass('loader-inactive');
            return false;
        }
    },
    onReady: {
        duration: 50,
        render: function ($container, $newContent) {
            $container.removeClass('is-exiting');// Remove your CSS animation reversing class
            $container.html($newContent);// Inject the new content
            setTimeout(init_template, 0)//Timeout required to properly initiate all JS Functions. 
            $('.loader-main').removeClass('loader-inactive');       
        }
    },
    onAfter: function($container, $newContent) {
        $('.loader-main').addClass('loader-inactive');  
    },
    alterRequest: function (request) {
        request.headers = {
            'Authorization': "Bearer " + window.access_token
        };
        return request;
    },
};

The page is a div inside the body.