Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
51c73c9476
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
33 lines (30 sloc) 1 KB
jQuery(document).ready(function( $ ) {
$(window).on("load scroll resize", function() {
var elem = $('#nav-wrapper');
if (!elem.attr('data-top')) {
if (elem.hasClass('navbar-fixed-top'))
return;
var offset = elem.offset();
elem.attr('data-top', offset.top - $('#wpadminbar').outerHeight());
}
if (elem.attr('data-top') - elem.outerHeight() <= $(this).scrollTop() - $(elem).outerHeight()){
elem.addClass('navbar-fixed-top');
elem.css('padding-top',$('#wpadminbar').outerHeight());
}
else {
elem.removeClass('navbar-fixed-top');
elem.css('padding-top','0');
}
if ($('#nav-wrapper').hasClass('navbar-fixed-top')){
$('.site-content').css('padding-top' , $('#nav-wrapper').height());
}
else {
$('.site-content').css('padding-top' ,'0px');
}
});
$(window).on("resize", function() {
var elem = $('#nav-wrapper');
var offset = $('#site-title').offset().top + $('#site-title').outerHeight();
elem.attr('data-top', offset - $('#wpadminbar').outerHeight());
});
});