sticky
sticky copied to clipboard
My attempt at a destroy method
Needs improving so it works with options.
Not sure if I am removing/resetting/unbinding too much or too little here...
OK, fixed the issue you mentioned on what was line # 89
Also added the code to only destroy the sticky on passed elements.
I think that's all that is needed - it works for me - but please check :)
There are a few outstanding issues:
- the position and top values are overwritten when the element is made sticky. These will need to be stored somewhere on the element so that they can be restored later on.
- the parent element needs to be removed
- the
stickedarray needs managing
...and i think I'm done!
:D
Just a note that you should watch out with the restored attributes.
I've just encountered the situation where an element has different position attribute value on desktop compared to mobile. My changes to the sticky script restore the position attributes from the time the sticky was applied, which may not be what you expect - funkiness may result.
Any attributes that vary like this should be overridden using !important in each set of responsive styles.
@gingerbeardman Thanks again for working on this! Sorry it has taken me a while to get to this. Unless something comes up, I'll be taking a look at this in the next week and merging it in.
Looks like an interesting pull request. Any news on this ? The plugin still doesn't have a destroy method :( Thanks for the great toot !
Any status on this? I need a destroy method to reset StickyJS when the user scroll to the top again.
Edit:
What does the unstick method do? Can't this help us?
@coffeeneed unstick just makes the item not-sticky but leaves a lot of effects of sticky in place. destroy aims to remove sticky and all traces of it from an element, returning it to as it was before it was made sticky.