Question

Nowadays on a lot of sites when I scroll down and reach a specified point I see these recommendation boxes where a box of content suddenly appears and It shows some kind of similar articles or recommendations.

I would be interested in the process of making this feature. I am not interested in recommendation systems or anything like that I am just interested in the technique that shows the box of content at a specified scroll point.

Is there a script out there or do I have to figure it out on my own and write the script? Is it some kind of Jquery maybe?

I would appreciate any word on this problem.

A good reference for what I am looking for is The Economist's site where You click on an article, scroll down and a similar article appears in the right bottom corner.

Here is a reference link on a random article where the function perfectly works: http://www.economist.com/news/leaders/21571136-politicians-both-right-and-left-could-learn-nordic-countries-next-supermodel

Was it helpful?

Solution

I believe you want to use scrollTop. http://api.jquery.com/scrollTop/ Basically you look for the scroll position and do something when it gets to a certain point.

Here is a fiddle: crude demo.

http://jsfiddle.net/YtGrf/

$('#test').scroll(function(){
    var loc = $(this).scrollTop();
    if(loc > 150) {
        alert('fire');
    }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top