-1

I will try to be as short as possible.

I'm trying to make a scrolling pattern as NY Times website have on single articles: http://www.nytimes.com/2014/09/27/world/europe/british-parliament-vote-isis-airstrikes.html for example.

When you go down in the article, only the top bar remain sticky. Then, after you go down enough, and scroll up fast, the recommended articles bar appear:

But, the fun part is that the bar doesn't appear if you scroll up slow.

So, I was thinking of using the jQuery Waypoints plugin, which can tell me the direction of scrolling, but this way, anytime I scroll up, the recommended news bar will appear and I don't need this.

I don't know exactly how to do the mathematical function which will tell me that the up scroll was fast enough to show the bar.

Any ideas?

Qantas 94 Heavy
  • 15,750
  • 31
  • 68
  • 83
Vlad
  • 9
  • 4
  • i did something like this some time ago in my page but i didn't care of the speed of the scrolling but the actual position, is not difficult using $(window).height(); http://stackoverflow.com/questions/303767/how-do-i-determine-height-and-scrolling-position-of-window-in-jquery – Manjar Sep 26 '14 at 11:03
  • Thank you for your message :). I know how to do it with .height() and I thought about it, but I want to see if I can get it further and make it like NYT. – Vlad Sep 26 '14 at 11:07

1 Answers1

0

Just store the last $(window).height() position when you scroll, and in the next scroll event compare the old with the new, if it's bigger than an determined threshold then you show the bar.

Manjar
  • 3,159
  • 32
  • 44