jquery.swatches icon indicating copy to clipboard operation
jquery.swatches copied to clipboard

Don't re-render when calling swatchify multiple times

Open tatemz opened this issue 10 years ago • 2 comments

When I have a <div class="swatch"> and I run $('.swatch').swatchify(); multiple times on the same DOM element, multiple swatches are produced. Would be great if swatchify() checked if the DOM element has already rendered color swatches to avoid cloning swatches.

Additionally, it would be ideal to have the DOM element recalculated to take changes to the data-colors attribute into account. This may hinder performance, so perhaps a swatchify( recalculate = true/false ) might be advisable.

tatemz avatar Jan 25 '15 19:01 tatemz

I agree with everything you've said. Unfortunately, I don't have much time to actively support this plugin anymore - but will gladly accept a working pull request :)

mixinmax avatar Jan 26 '15 21:01 mixinmax

Will do! :+1:

tatemz avatar Jan 27 '15 18:01 tatemz