Closed justanotherco closed 6 years ago
Fixed with .data('hcSticky').reinit();
@justanotherco Actually it's a bug, it should be attached to the element directly. Thanks for noticing this, I'll fix it.
My bad, it shouldn't be on the element.
@justanotherco I've updated the plugin so now you can call the methods properly like this:
var $sticky = $('#element');
$sticky.hcSticky({
stickTo: '#content'
});
// Call the refresh method
$sticky.hcSticky('refresh');
That's great news, thanks for the hard work! Out of curiosity, are there any benefits to using it that way instead of data('hcSticky') apart from the more standerized syntax?
In case I ever change the way the methods are attached to the jQuery object, by using standardised syntax you ensure that everything will continue to work properly.
Hey there,
Trying to run the reinit method but can't understand how it works. Could you please look at this non-working pen and if possible point out what's wrong with it? The console always says reinit is not a function
https://codepen.io/anon/pen/xzavRw?editors=1111
Thanks in advance