简体   繁体   中英

How to make input type color working in IE-11 in 2020?

How to make input type color working in IE in 2020?

<input type="color">

I tried a lot of polyfills but no luck yet. As a last resort, what external library do you recommend?

For anyone encountering this question, this is the polyfill for IE support:

https://github.com/jonstipe/color-polyfill

This is a polyfill for implementing the HTML5 <input type="color"> element in browsers that do not currently support it.

How to use this:

Using it is easy — simply include the color-polyfill.js file in the HEAD of the HTML page. You can then use <input type="color"> elements normally.

If Modernizr detects that the browser doesn't support <input type="color"> , the script will replace these elements with a JavaScript-powered color picker dialog.

A default CSS file is provided. You may edit this file to style the buttons and dialog box to make them look the way you want.

If Modernizr detects support for CSS transitions, you will be able to animate the opening and closing of the dialog box by writing a CSS transition in the CSS file. Otherwise, a jQuery animation is used.

Dependencies: This script requires jQuery, jQuery UI, and Modernizr.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM