本文介绍了如何关闭html5颜色选择器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在OSX上的Chrome中,当您使用type = color的输入选择颜色时

In chrome on OSX when you select a color using a input with type=color:

<input name="color" type="color" />

即使选择了颜色,拾色器仍保持打开状态.即使您重新加载页面,它也保持打开状态.

The color picker stays open even after choosing a color. It stays open even when you reload the page.

选择颜色后如何关闭此选择器弹出窗口?

How can I close this picker popup when a color is chosen?

推荐答案

颜色选择器在很大程度上取决于每个浏览器,每个平台的实现.从技术上讲,没有办法以编程方式关闭跨浏览器解决方案的颜色选择器.

The color picker depends heavily on a per-browser, per-platform implementation. There's technically no way to close the color picker programatically as a cross-browser solution.

您可以做的是使用Javascript解决方案来呈现自己的跨平台颜色选择器,例如 jscolor 或类似的,甚至有适当的触摸支持.

What you can do instead is using a Javascript solution to render your own, cross-platform color picker like jscolor or similar, those even have proper touch support.

在此列表中,您可以看到input type="color"中没有任何close事件.进一步的阅读告诉我,由于这只是文本输入或范围输入之类的输入,因此您不能控制"它.另一种可能是创建自己的.

In this list you can see there's no close event in the input type="color". Further reading tells me that since this is just an input like a text input or range input, it's not something you can "control". The alternative may be creating your own.

这篇关于如何关闭html5颜色选择器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 03:58
查看更多