Created
April 4, 2017 04:54
-
-
Save wykydtronik/9f3efa56b50841280811b2ef8696b12b to your computer and use it in GitHub Desktop.
This file contains 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
/** | |
* bodymargin.js | |
* | |
* Dynamic margin-top for body element. | |
*/ | |
if (typeof jQuery === 'undefined') { | |
throw new Error('Flation Theme\' requires jQuery') | |
} | |
+function($) | |
{ | |
$(document).ready(function(){ | |
if ( $("body").width() > 992 ) { | |
var margintop = $("#navbar").height() + 20; | |
$("body").css('margin-top', margintop); | |
} | |
if ( $('#wpadminbar').length && $("body").width() < 600 ) { | |
$(window).scroll(function(){ | |
var bo = $("body").scrollTop(); | |
if ( bo > 46 ) { | |
$(".navbar").css('top', "0"); | |
} else { | |
$(".navbar").css('top', "46px"); | |
} | |
}); | |
} | |
}); | |
}(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment