GithubHelp home page GithubHelp logo

tkrotoff / jquery-simplecolorpicker Goto Github PK

View Code? Open in Web Editor NEW
388.0 27.0 86.0 115 KB

Very simple jQuery color picker

Home Page: http://plnkr.co/edit/VVclW0?p=preview

License: MIT License

CSS 7.89% JavaScript 18.85% HTML 73.25%

jquery-simplecolorpicker's People

Contributors

dotjoel avatar powerbuoy avatar tkrotoff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-simplecolorpicker's Issues

Position not updated when window width changes

Testet on Google Chrome Version 60.0.3112.113 (Offizieller Build) (64-Bit)

Because the colorpicker is insertet directly under the body tag in the DOM it is not updating its position when it is opened and the window with changes.

Solution may be to add 'position: relative;' CSS to the element which opens the colorpicker by click. And then define the position of the color palette absolute to the parent element. Because the parent is moved correctly when the window size changes.

Disable Color Picker

Is there any possibility to disable the color picker? I could not figure out how to do it.

Setting disabled attribute does not work: <select name="colorpicker" disabled>

selectColor only likes hex colors in lowercase

selectColor only like hex colors in lowercase.
...('selectColor' , '#FF00FF'); -<breaks
...('selectColor' , '#ff00ff'); -< is ok

Hex color in uppercase brings up error message (console).

The given color '#FF00FF' could not be found.

-Cheers :-)

Multiple select colors

Hello, color picker is awesome.

Could you provide a little change with color picker, so i could select several colors with it?

I want to do a colors filter on my site, and i need color swatches are to be multiselectable.
I have tried to set 'multiple="multiple"' on http://plnkr.co/edit/VVclW0?p=preview but it not brings any effect.

Thank you.

Multi-line

How would I make the individual color blocks float inline - so when the space they're in is say a .span2 - they create multiple lines as they fill up the width?

Bootstrap modal gets the "picker" tail

When using the inline color picker on a Bootstrap modal, the "picker" tail (i.e the little point "^" thing) is added to the outside of the modal div.

Click on background (not a color) of the picker fires a change event

Ciicking on the Picker background span instead of Color Button span is firing a change event. Need to check if it is a button that was clicked.

    click: function (e) {
        alert('here');
        var target = $(e.target);
        if (target.length === 1) {
            if (target[0].nodeName.toLowerCase() === 'span') {
                if (target.attr('role') == 'button') {               // FIXES
                    // When you click on a color, make it the new selected one
                    this.selectColorSpan(target);
                    this.$select.trigger('change');
                }
            }
        }
    },

Are labels for colours possible?

Excellent plugin would love to use it. Is it possible to add labels for colours? If not would you mind if I fork and try to add them?

Generated HTML not validated by W3C

Element div not allowed as child of element span in this context. (Suppressing further errors from this subtree.)
<span class="simplecolorpicker inline"><div class="selected" title="Green" style="background-color: #7bd148" data-color="#7bd148" role="button" tabindex="0">&nbsp;&nbsp;&nbsp;&nbsp;</div>

(Use this bookmark to validate offline dynamically generated HTML: http://stackoverflow.com/questions/10377840/making-finding-html5-validator-bookmarklet/10420384#10420384)

jQuery $('#id').val() should not return null for a "disabled selected" HTML select option

<select id="colorpicker">
  <option value="#7bd148">Green</option>
  <option value="#5484ed">Bold blue</option>
  <option value="#a4bdfc" selected disabled>Blue</option>
  <option value="#46d6db">Turquoise</option>
  <option value="#7ae7bf">Light green</option>
  <option value="#51b749">Bold green</option>
  <option value="#fbd75b">Yellow</option>
  <option value="#ffb878">Orange</option>
  <option value="#ff887c" selected disabled>Red</option>
  <option value="#dc2127">Bold red</option>
  <option value="#dbadff">Purple</option>
  <option value="#e1e1e1">Gray</option>
</select>

With jQuery

$('#colorpicker').val();

returns null

Without jQuery

// See How to get the selected value of dropdownlist using JavaScript? http://stackoverflow.com/questions/1085801/how-to-get-the-selected-value-of-dropdownlist-using-javascript
var e = document.getElementById('colorpicker');
e.options[e.selectedIndex].value;

returns "#ff887c"

Bower support

Hello,
could you please add Bower support (it's very simple, just a .json in the root folder)?

.val returning wrong value

Have multiple selects on a page created dynamically.
When doing .val() on change, the value returned is the first select/option, not what was selected.

Thanks
-C :-)

Needs a package.json

Are you still supporting this? If so, it's important to add a correctly configured package.json file so that the repo can be installed via npm.

Selected color value to other javascripts

How can I have other javascripts access the selected color value from simplecolorpicker? Can I set it as a var?

I see the $('select[name="colorpicker"]').val()); setting the background color in the sample via css.

Thanks for your sample.

Handle disabled inside option

User should not be able to select the blue color:

<select name="colorpicker-picker">
  <option value="#7bd148">Green</option>
  <option value="#a4bdfc" disabled>Blue</option>
</select>

Accessibility issues

Hi there, a couple of issues we are working to resolve

  1. When using picker mode, that should have the default focus so you can tab through each of the items
  2. Enter should select the item, shouldn't require a mouse click.

Once I have a fix i'll reply to this if you want to merge.

Ability to set "No Color"

Great plugin firstly, it's a nice and simple.

I'm wondering if there's a way to have no color selected? It looks like the plugin assumes that some colour will always be selected by the user since it preselects the first colour.

thanks
George

Multiple selection

It would be great, if that plugin will allow to select multiple color boxes (and based on checkbox element).

Anyway, it's awesome plugin, thank you!

AMD Support

AMD and RequireJS are becoming a very popular way to manage JavaScript libraries. It would be great to see this library have AMD support.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.