Terry Do (hou.dobaotrung@gmail.com)
Custom Sticky is small, free open-source plugin which helps you in making sidebar sticks on scrolling and stay where it is instead of returning its original position when unsticking. This is mainly used for sticky sidebars.
$("#yoursidebar").customSticky();
- road
- Define the scroll path's length that the sidebar'd be fixed. Default: 1000 (px).
- destroy
- Destroy the plugin. Default: false.
- unstickBefore (jQuery Object)
- Don't use along with road. Your sidebar will stop being fixed before this element's top border. Default: NULL.
- offsetTop, offsetBottom, offsetLeft, offsetRight
- Positioning the sidebar after being fixed. Default: 0;
// Unstick and stay where it is after scrolling 2000px.
$("#yoursidebar").customSticky({
road: 2000,
})
// Unstick and stay where it is after scrolling to the top of an element.
$("#yoursidebar").customSticky({
unstickBefore: $('#div'),
})
// Rekt it!
$("#yoursidebar").customSticky({
destroy: true,
})
- Jquery v1.7.1 or above is required.
- MIT License