File size: 660 Bytes
e1d589b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | define(['domReady','jquery','jqueryEasing'], function(domReady) {
var smoothScroll = function(evt){
evt.preventDefault();
var anchor = $(evt.target).attr('href');
if (typeof anchor === 'undefined' || anchor === '') {
return;
}
try {
$('html,body').stop().animate({
scrollTop: (anchor === '#top' ? 0 : $(anchor).offset().top)
},750, 'easeInOutExpo');
setTimeout(function(){
window.location.hash = anchor;
}, 850);
} catch (exception) {
window.location.hash = anchor;
}
return false;
};
domReady(function(){
$('a[href^="#"]').on('click', smoothScroll);
});
});
|