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

Top position is off when using 'position: top' with swatches #236

Open
av01d opened this issue Nov 23, 2017 · 0 comments
Open

Top position is off when using 'position: top' with swatches #236

av01d opened this issue Nov 23, 2017 · 0 comments

Comments

@av01d
Copy link

av01d commented Nov 23, 2017

When you use minicolors with swatches, combined with position: 'top left' or position:'top right', the colorpicker panel is positioned incorrectly, it overlays the input box.
minicolors1
minicolors2

I've made the following fix in jquery.minicolor.js, starting at line 212:

    // Swatches
    if(settings.swatches && settings.swatches.length !== 0) {
      if (/top/.test(settings.position)) {
         var nrRows = Math.ceil(settings.swatches.length / 7);
         panel.css('top', (nrRows == 1 ? -182 : -204)+'px');
      }
      panel.addClass('minicolors-with-swatches');
      ....

Variable nrRows contains the number of rows of swatches (either 1 or 2), and the top position is changed accordingly. This fixes it for me. Hopefully you can apply this (or a similar) fix.
Thanks, keep up the good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants