Pinned

A jQuery plugin for creating sticky elements

View the Project on GitHub DrewDahlman/Pinned

Pinned

A jQuery plugin for creating "pinned" or sticky elements on a page.

Features

Quickly create pinned elements on page, also support mobile devices such as mobile safari.

Use

$("#element").pinned({
    bounds: 100, // when to become sticky
    scrolling: 0, // position during scroll
    mobile: false // should support mobile 
});

Callbacks

If you wish you can have callbacks in your code for when your element becomes pinned and unpinned.

$("#element").pinned({
    bounds: 100, // when to become sticky
    scrolling: 0, // position during scroll
    mobile: false // should support mobile 
},function(){
    // PINNED
},
function(){
    // UNPINNED
});

Methods

$("#element").pinned();

CSS

#element {
    position: absolute;
    top: 100px;
}

To use Pinned call the plugin by feeding your element selector, either ID or class, be sure to set your sticky element to position absolute!