Search code examples
jquerycssfixedsticky

Temporary Sticky Items like 9gag


I search a way to make a sticky images information like 9gag.com. (https://i.sstatic.net/6SuX4.png)

That not easy because the elements need to be fixed when the article are at the top of the window.

If someone know a plugin or a way to do this, that would be great :)

Thanks in advance.


Solution

  • exactly what you are looking for is here DEMO... http://jsfiddle.net/yznnJ/

    Tutorial and author page is here... http://viget.com/inspire/jquery-stick-em

    CSS

    .stickem-container {
        position: relative;
    }
    
    .stickit {
        margin-left: 660px;
        position: fixed;
        top: 0;
    }
    
    .stickit-end {
        bottom: 0;
        position: absolute;
        right: 0;
    }
    

    JQUERY

    $(document).ready(function() {
        $('.container').stickem();
    });