Template:Waterloo/JS/header.js
// scripts for header
// for capitalizing id String.prototype.capitalize = function() {
return this.charAt(0).toUpperCase() + this.slice(1);
}
// detects scroll for top resizing and lower nav show $(window).scroll(function() {
if ($(document).scrollTop() > 50) { $('.navbar-fixed-top').addClass('shrink'); if ($('#inner-page-links').children().length > 0) { $('.outer-nav-box').removeClass('hide-lower') } } else { $('.navbar-fixed-top').removeClass('shrink'); $('.outer-nav-box').addClass('hide-lower') }
});
// set lower navbar $('.navbar-lower').affix({
offset: {top: 200}
});
// fills in lower nav with inner page links $(document).ready(function(){
$('.link', '.accordion-heading').each(function(i, obj) {$("#inner-page-links").append('
}); if ($('#inner-page-links').children().length < 1) { $('.outer-nav-box').addClass('hide-lower') }
});
// for smooth scrolling // $(function() { // $('a[href*=#]:not([href=#])').click(function() { // if (location.pathname.replace(/^\//,) == this.pathname.replace(/^\//,) && location.hostname == this.hostname) { // var target = $(this.hash); // target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); // if (target.length) { // $('html,body').animate({ // scrollTop: target.offset().top // }, 500); // return false; // } // } // }); // });