You can connect to the scroll event via jQuery and use a combination of timestamps and scrollOffset to determine the scroll speed by comparing the offset time / time with the last scroll event. Something like that:
var lastOffset = $( mySelector ).scrollTop(); var lastDate = new Date().getTime(); $( mySelector ).scroll(function(e) { var delayInMs = e.timeStamp - lastDate; var offset = e.target.scrollTop - lastOffset; var speedInpxPerMs = offset / delayInMs; console.log(speedInpxPerMs); lastDate = e.timeStamp; lastOffset = e.target.scrollTop; });
In any case, since you have no control over the navigation bar in regular browsers, I donβt see the point here: /
You might be looking for something like this: Parallax scroll with sticky title
GL Chris
cschuff
source share