javascript - SmoothState onAfter callback -


i have site has elements slider on pages. trying implement smoothstate js running issue of second page breaking. know through documentation need add onafter callback wondering , how applied. apparently can tricky if unfamiliar ajax.

here documentation on issue.

and code have fires script:

$(function(){   'use strict';   var $page = $('#uber'),       options = {         debug: true,         prefetch: true,         cachelength: 2,         onstart: {           duration: 250, // duration of our animation           render: function ($container) {             // add css animation reversing class             $container.addclass('is-exiting');             // restart animation             smoothstate.restartcssanimations();           }         },         onready: {           duration: 0,           render: function ($container, $newcontent) {             // remove css animation reversing class             $container.removeclass('is-exiting');             // inject new content             $container.html($newcontent);           }         }       },       smoothstate = $page.smoothstate(options).data('smoothstate'); }); 

does have ideas on how add onafter callback?

i've started trying out smoothstate, here first worked me.

$(document).ready(function(){   prep();  });  $('#main').smoothstate({   onafter: function() {     prep();   } });   function prep(){        $('#loadbtn').click(function () {             $( '#remote1' ).load( 'external.html #myexternaldiv', function( response, status, xhr ) {             if ( status == 'error' ) {               var msg = 'sorry there error: ';               $( '#error' ).html( msg + xhr.status + ' ' + xhr.statustext );             }             $('#remote1').slidetoggle();           });        });   } // prep 

so put stuff go $(document).ready section prep() function. call both doc init , onafter.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -