jquery.swatches
jquery.swatches copied to clipboard
Don't re-render when calling swatchify multiple times
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.
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 :)
Will do! :+1: