I am building a website with a fixed top menu, once a user scrolls down, the menu disappears and when the user scrolls back up, it appears again.

It makes sense that when a user scrolls up, he want to access the menu.

The following code works great on Windows but not on Mac:

$(function(){ var _top = $(document).scrollTop(); var _direction; $(document).scroll(function(){ var _cur_top = $(document).scrollTop(); if(_top < _cur_top) { $('.navbar-fixed-top').fadeOut(500); } else { $('.navbar-fixed-top').fadeIn(500); } _top = _cur_top; }); });

When you scroll to the top on a IOS device, it allows you to scroll past the actual page, this occurs on all IOS devices, whether it is touch screen or mouse operated.

This causes the page to scroll down again which fires the "fadeOut" and hides the menu.

What I want is that when a user reaches the top of the page, the scrolling deactivates.

Thanks.