I set my hero-unit to position fixed after scrolling down to it's position. So for the first 70px of the page the hero-unit scrolls along with the rest until the top reaches the hero-unit which then needs to be fixed.
Not fixed
Fixed
This works fine everywhere and also the ipad except that the position is set to fixed when the scroll is finished instead of during the scrolling like the browser.
I know it's because the scroll event is not fired during the momentum scrolling. I tried to fix this using the following code but it did not work:
document.addEventListener("touchstart", function(){
$('body').prepend('<p>touch start</p>');
that.tid = setInterval(function(){
$.event.trigger(
{ type: "touchcontinuem" }
);
},10)
}, false);
document.addEventListener("touchend", function(){
$('body').prepend('<p>touch end</p>'); clearTimeout(that.tid);
}, false);
$(document).on("touchcontinuem", function(){
$('body').prepend('<p>touch continuem</p>');
});
What I want to achieve is that the hero-unit can be set to fixed while the scroll is still busy. If anyone can suggest an improvement or an alternative I would greatly appreciate because i'm stuck right now.