stickUp
stickUp copied to clipboard
Using this plugin with dynamic elements
I have a problem with the vartop variable. It´s actually used as soon as I load the plugin and gets bound to the scroll event. I call the stickUp function from ajax callback because I am using the sticky feature for a progress bar.
Bacause the scroll event is bound and the vartop is not defined it will throw some errors on javascript console.
My workaround is, initialize vartop during the load of your plugin. Then there´s no error and the value gets a real value as soon as I call the stickUp function.
var stickyMarginB = 0;
var currentMarginT = 0;
var topMargin = 0;
var vartop = 0;
$(window).scroll(function(event){
var st = $(this).scrollTop();
if (st > lastScrollTop){