2016-04-29 7 views
0

Ich benutze smoothstate.js auf WordPress und ich versuche herauszufinden, wie die aktuelle Seite aktiv bleibt, bis die nächste vollständig geladen ist: so wird die neue Seite angezeigt wie die aktuelle Seite beendet wird. Hier ein Beispiel: http://springsummer.dk/SmoothState.js Aktuelle Seite anzeigen, bis nächste geladen wird

Hier ist mein Code:

(function($) { 
'use strict'; 
var $page = $('#main'), 
    options = { 
     debug: true, 
     prefetch: true, 
     cacheLength: 10, 
     onStart: { 
      duration: 1000, // Duration of our animation 
      render: function ($container) { 
       // Add your CSS animation reversing class 
       $container.addClass('is-exiting'); 
       // Restart your animation 
       smoothState.restartCSSAnimations(); 
      } 
     }, 
     onReady: { 
      duration: 0, 
      render: function ($container, $newContent) { 
       // Remove your CSS animation reversing class 
       $container.removeClass('is-exiting'); 
       // Inject the new content 
       $container.html($newContent); 
      } 
     }, 
     onAfter: function ($container) { 
      $container.removeClass('is-exiting'); 
     } 
    }, 
    smoothState = $page.smoothState(options).data('smoothState'); 
})(jQuery); 

Antwort

0

Die Lösung, die ich gefunden ist, die aktuelle Seite in einem temporären Wrapper zu klonen.

Verwandte Themen