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

Clear colour does not trigger change event #57

Open
mattheu opened this issue Jun 26, 2016 · 2 comments
Open

Clear colour does not trigger change event #57

mattheu opened this issue Jun 26, 2016 · 2 comments

Comments

@mattheu
Copy link

mattheu commented Jun 26, 2016

If I have already set the colour, but I want to remove it later, I cannot as it does not trigger a change event.

Related to #53

@NRDay
Copy link

NRDay commented Sep 25, 2017

Has there been any development with this? I'm using 2 pickers to create a background gradient. When a color is chosen in either of the pickers the change callback gets the values of the 2 pickers to create a linear-gradient css rule. It all works fine until you try to clear either of them. Obviously the change callback is not fired. Just wondering if anyone has manage to find a work around?

@vinnyusestrict
Copy link

vinnyusestrict commented Aug 16, 2021

2021 and still nothing on this?

Here's a hack for the time being.

var added_clearer = false;
$('.color-field').wpColorPicker({
    change: function(){
        if ( ! added_clearer ) {
            $('.wp-picker-clear').on('click', function(){
                $(this).parent('.wp-picker-input-wrap').find('.color-field').change();
            });
            added_clearer = true;
        }
    }
});

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

3 participants