jQuery-Collapse icon indicating copy to clipboard operation
jQuery-Collapse copied to clipboard

Add a "destroy" method

Open ryan-ludwig opened this issue 10 years ago • 8 comments

First off, excellent plugin.

It would be very nice to be able to remove all collapse click handlers and expand all of the collapsed items programmatically, perhaps like $("myelement").collapse("destroy");

My use case is for a responsive site. On small screens I collapse all of the sections, similar to mobile Wikipedia. On larger screens all of the sections are open, similar to desktop Wikipedia. On large screens I don't want the user to be able collapse sections so I need to unbind all of those click handlers.

Really the destroy method would undo everything that the plugin has done earlier, e.g., remove ARIA attributes, remove elements that were created, unbind events, etc.

ryan-ludwig avatar Feb 26 '14 22:02 ryan-ludwig

Yeah I gotcha, let me think about it for a while :)

Edit: I'm a bit busy now, but you're welcome to submit a pull request

danielstocks avatar Feb 27 '14 13:02 danielstocks

+1

thedgbrt avatar Oct 04 '15 12:10 thedgbrt

+1

mjarmoc avatar Apr 20 '16 11:04 mjarmoc

+1

Teque5 avatar Jun 09 '16 23:06 Teque5

Hi,

Thanks for this great plugin ! +1 This feature really would be welcome for responsive sites. Missing no more than that to it becoming a perfect plugin. ;-)

Have a good day.

alexandre-stimpfling avatar Nov 10 '16 08:11 alexandre-stimpfling

+1 this is also useful for single page applications when events have to be destroyed when removing elements from DOM.

kouts avatar Nov 26 '16 14:11 kouts

+1 @danielstocks Thx for your plugin. On 27 Feb 2014 you stated you think about a destroy feature. Any plans implementing this? THX

upstroke avatar Aug 14 '17 09:08 upstroke

+1

This is useful for turbolink applications where we need to initialize/destroy ...

chamnap avatar Jun 01 '20 11:06 chamnap