sticky-kit
sticky-kit copied to clipboard
Accept a function for offset_top
Currently the offset_top
option can only be set upon initialization. Is there anyway to update the offset_top value without detaching the plugin first? Perhaps by accepting a function for the offset_top
option.
Thanks!
See this example:
jQuery(document).ready(function(){ var window_width = jQuery( window ).width();
if (window_width < 960) { jQuery("#sticky").trigger("sticky_kit:detach"); } else { make_sticky(); }
jQuery( window ).resize(function() { window_width = jQuery( window ).width(); if (window_width < 960) { jQuery("#sticky").trigger("sticky_kit:detach"); } else { make_sticky(); } });
function make_sticky() { jQuery("#sticky").stick_in_parent({ offset_top: 100, parent: '#row-content .wrapcent' }); } });
i also look for an easy event function to update offset_top!