I think you are looking for the the scrollTop
method. The height
method will return the actual window height, that will only change if the window is resized.
More info: http://api.jquery.com/scrollTop/
Question
I'm trying to use a function that checks the window height when the user scrolls and 'if' the window height is at a certain level then an action is fired.. but I can't seem to get it to work... The code I have is:
$(window).scroll(function() {
if ($(window).height() < 100) {
$(".mobnav").slideUp(10);
}
});
Any reason why this shouldn't work? Some help would be much appreciated.
Cheers
Solution
I think you are looking for the the scrollTop
method. The height
method will return the actual window height, that will only change if the window is resized.
More info: http://api.jquery.com/scrollTop/