Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty Container before adding #81

Closed
Falke-Design opened this issue Jul 28, 2019 · 0 comments
Closed

Empty Container before adding #81

Falke-Design opened this issue Jul 28, 2019 · 0 comments

Comments

@Falke-Design
Copy link
Contributor

First: Thanks for this powerful tool!

In a project from me, I add the colorpicker every time if i open a container and also once on page first loading. Before I add the picker, i empty the picker-div. Now is the problem, if the container is opened to fast while first initalisation, i have two pickers in the div.

I tried to reproduce this in jsfiddle, but it don't worked.
So here the link to my project: Demo

While initalisation, you have to click on the pen at the left side. Then you see the 2 colorpicker.

So my suggestion is to add a option, if the container should be emptied before appending the picker.

My Code:

$('#colorPicker').empty();
    // Create a new color picker instance
    // https://iro.js.org/guide.html#Getting-Started
    var colorPicker = new iro.ColorPicker("#colorPicker", {
        // color picker options
        // Option guide: https://iro.js.org/guide.html#Color-Picker-Options
        width: 180,
        height: 180,
        color: colorobj.fill,
        anticlockwise: true,
        borderWidth: 1,
        borderColor: "#fff",
        // Dynamic CSS guide: https://iro.js.org/guide.html#Dynamic-CSS
        css: {
            ':root': {
                '--color-wheel': '$color'
            }
        }
    });

Thanks

@jaames jaames closed this as completed Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants