This is probably intermittent because it scrolls ALOT while scrolling, in fact I am sure that IOS mobile pauses javascript execution while the user scrolls.
Instead, I suggest using an interval, you can adjust the time between each interval to what works well for your use case.
Although it may seem intense that it fires this logic every X milliseconds when using the scroll event, you can fire the event hundreds of times per second, which will be much more intense and noticeable for the user using the device with the maximum processing power.
(function () { var interval = null,
Lee brindley
source share