Answer the question
In order to leave comments, you need to log in
Why doesn't javascript work on a small screen resolution?
var header = $("#header"),
introH = $("#intro").innerHeight(),
scrollOffset = $(window).scrollTop();
/* Fixed Header */
checkScroll(scrollOffset);
$(window).on("scroll", function () {
scrollOffset = $(this).scrollTop();
checkScroll(scrollOffset);
});
function checkScroll(scrollOffset) {
if (scrollOffset >= introH) {
header.addClass("fixed");
} else {
header.removeClass("fixed");
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question