Created
August 5, 2014 15:57
-
-
Save miguel-perez/07b85ae1f7bea5f536fc to your computer and use it in GitHub Desktop.
New smoothState signature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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