js.msb3-scroll.js Maven / Gradle / Ivy
Go to download
Msb3 is an Apache Maven site skin built on Twitter Bootstrap 3.3.
It allows various structural and stylistic customizations to create
a modern-looking Maven-generated website. Requires Msb3 Velocity Tools.
The newest version!
// Support for smooth scrolling
// (simplified version, taken from http://stackoverflow.com/a/14805098/1173184)
$(window).load(function(){
$('a[href^="#"]:not([href^="#carousel"]):not([data-toggle="dropdown"])').on('click', function(e) {
// prevent default anchor click behavior
e.preventDefault();
// store hash
var hash = this.hash;
// animate
$('html, body').animate({
scrollTop: $(this.hash).offset().top
}, 300, function(){
// when done, add hash to url
// (default click behaviour)
window.location.hash = hash;
});
});
$('#toc-bar').affix({
offset: {
top: $('#toc-bar').offset().top
}
});
});