REFactor: encapsulate scroll check logic into a function
This commit is contained in:
@@ -39,13 +39,17 @@ jQuery(function($) {
|
||||
})
|
||||
|
||||
jQuery(function($) {
|
||||
$(window).scroll(function() {
|
||||
if ($(this).scrollTop() >= 100) {
|
||||
function checkScroll() {
|
||||
if ($(window).scrollTop() >= 100) {
|
||||
$('header#masthead').addClass('fixed');
|
||||
} else {
|
||||
$('header#masthead').removeClass('fixed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$(window).scroll(checkScroll);
|
||||
|
||||
checkScroll();
|
||||
});
|
||||
|
||||
jQuery(document).ready(function ($) {
|
||||
|
||||
Reference in New Issue
Block a user