sticky icon indicating copy to clipboard operation
sticky copied to clipboard

My attempt at a destroy method

Open gingerbeardman opened this issue 13 years ago • 8 comments

Needs improving so it works with options.

Not sure if I am removing/resetting/unbinding too much or too little here...

gingerbeardman avatar Aug 21 '12 10:08 gingerbeardman

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 :)

gingerbeardman avatar Aug 30 '12 14:08 gingerbeardman

There are a few outstanding issues:

  1. 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.
  2. the parent element needs to be removed
  3. the sticked array needs managing

gingerbeardman avatar Aug 30 '12 14:08 gingerbeardman

...and i think I'm done!

:D

gingerbeardman avatar Aug 30 '12 16:08 gingerbeardman

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 avatar Oct 03 '12 17:10 gingerbeardman

@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.

garand avatar Jan 08 '13 01:01 garand

Looks like an interesting pull request. Any news on this ? The plugin still doesn't have a destroy method :( Thanks for the great toot !

regisphilibert avatar Mar 06 '14 16:03 regisphilibert

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 avatar Jan 18 '17 09:01 coffeeneed

@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.

gingerbeardman avatar Jan 18 '17 11:01 gingerbeardman