color picker

color picker

 

最近项目要用到一个color picker, 前台是用JSF开发的,我首先想到 richfaces rich:colorPicker,但是发现rich:colorPicker is only available since 3.3.1.,我现在用的version 是3.3.0,于upgrade it to 3.3.2. , the latest version is 3.3.3

rich:colorPicker可以显示,但不能选择color,出现JS error:jQuery(".rich-color-picker-color").pngFix is not a function, google一下,其官方文档说在version is 3.3.3中,rich:colorPicker的CSS存在bug,于是放弃了。

 

又从网上找了一个color piker,效果不错,而且相当easy.

JSF code:

 

<script type="text/javascript" charset="utf-8"
            src="<%=response.encodeURL(request.getContextPath() + "/js/jscolor/jscolor.js")%>"></script>

 

              <td>
                 <h:outputLabel value="Banner Background Colour"/>
             </td>
             <td colspan="2">
                <h:outputText value="<input class='color' value='#{agencyWebsiteUserEditBean.awsBannerBGColour[0]}'>" escape="false"/>
             </td>

 

关銉是class='color',同时可以加入其它option

 

<input class="color {required:false}">
<input class="color {adjust:false}">
<input class="color {hash:true}">
<input class="color {hash:true,caps:false}">

 

Demo: http://jscolor.com/try.php

Download:http://jscolor.com/download.php

你可能感兴趣的:(JavaScript,jquery,PHP,Richfaces,JSF)