Skip to content

Instantly share code, notes, and snippets.

@miguel-perez
Created August 5, 2014 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguel-perez/07b85ae1f7bea5f536fc to your computer and use it in GitHub Desktop.
Save miguel-perez/07b85ae1f7bea5f536fc to your computer and use it in GitHub Desktop.
New smoothState signature
// Contents of functions.js
;(function($) {
'use strict';
var $body = $('html, body'),
content = $('#main').smoothState({
// Runs when a link has been activated
onStart: function(url, $container) {
// toggleAnimationClass() is a public method
// for restarting css animations with a class
content.toggleAnimationClass('is-exiting');
// Scroll user to the top
$body.animate({
'scrollTop': 0
});
}
}).data('smoothState');
//.data('smoothState') makes public methods available
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment