imgCheckbox icon indicating copy to clipboard operation
imgCheckbox copied to clipboard

Add ability to destroy/remove imgCheckbox instance

Open sherwinflight opened this issue 7 years ago • 2 comments

I'm currently working on a project where the action that fires when you click an image is difference based on another option.

I have most of this working. When the page loads I can click the image and they open in my lightbox. When I click the toggle button on the page the lightbox script is removed from the images, and imgCheckbox is enabled. So far so good.

However, when I toggle the button off again my lightbox is reinitialized, but the imgCheckbox code is still attached to the images.

There needs to be a way to easily remove the imgCheckbox code from a group of images, along with the additional form fields that were added.

Maybe something like $(".selector").imgCheckboxRemove()

sherwinflight avatar Oct 05 '17 08:10 sherwinflight

To be honest, I haven't done much with imgCheckbox in a couple of years. If you want to implement this and submit a PR, I am definitely willing to merge it in (that's what I've done with other issues recently) but I won't have time to actually implement this myself.

I like the idea though and I will leave the issue open! Thanks.

jcuenod avatar Oct 07 '17 17:10 jcuenod

Maybe one thing I'll add is that the way I immediately thought of adding this would be to start at https://github.com/jcuenod/imgCheckbox/blob/master/jquery.imgcheckbox.js#L293 and check if the option in $(img).imgCheckbox(option) is just false so:

$("#selector").imgCheckbox(false)

and that would then disable it.

jcuenod avatar Oct 07 '17 17:10 jcuenod