Help get this topic noticed by sharing it on Twitter, Facebook, or email.
I’m thankful

Prevent unhelpful scroll following by checking viewportHeight against boxHeight

I am using Scroll Follow to implement a more relaxed kind of photo gallery, where the user just scrolls through the web page normally and the enlarged photo follows him along (with the list of thumbnails to the side). A welcome departure from that horribly overused script where the image pops up over the page after an enormously long animation.

My use serves to demonstrate an important flaw in the current design: the box set to follow the user's scrolling will always be repositioned to sit at the top of the viewport even if it is itself larger than the viewport! This means that if the user has a small screen resolution and is viewing a big image, he has to fight with Scroll Follow to be able to see the bottom of that image. (Basically chase the image to the bottom of the page, at which point the script will let go).

That was certainly not optimal for me, so here's a possible fix which fits on line 63ish:

Instead of “if ( isActive )” ...

“if ( isActive && viewportHeight > boxHeight )”

Now the viewport being smaller than the box will stop Scroll Follow in its tracks.

I'm not sure if this is the best technical solution to the problem, but it works for me :)
1 person likes
this idea
+1
Reply