PhoneGap 中颜色选择器的示例代码

2023-12-07

我无法修复phonegap 中的colorpicker.js,它不起作用!请帮忙吗?

thanks

$('#colorSelector').ColorPicker({
                    color: '#0000ff',
                    onShow: function (colpkr) {
                        $(colpkr).fadeIn(500);
                        return false;
                    },
                    onHide: function (colpkr) {
                        $(colpkr).fadeOut(500);
                        return false;
                    },
                    onChange: function (hsb, hex, rgb) {

                        //$('body').css('background', '#' + hex);
                        $("#hex_color").val('#'+hex);

                    }
                });
    var html ='<div id="texto">';
                        html +='<input id="newtext" type="text" value="Hello!">';

                        //html +='<input id="change" type="color" value="#ff0667" data-text="hidden" style="height:20px;width:20px;" />';

                        html += '<input type="text" id="hex_color">';
                        html += '<div id="colorSelector"><div style="background-color: #0000ff"></div></div>';

                        html +='<button id="addbutton">Add this text</button>';
                        html +='</div>';

Try 光谱取色器。这是非常好的颜色选择器插件。

下载 zip 文件并包含spectrum.js文件和spectrum.css文件到您的页面。然后你必须创建一个文本框,如下所示

<input type='color' id='custom' />

在你的脚本文件中

 $("#custom").spectrum({
    color: "#f00"
 });

希望对您有帮助

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

PhoneGap 中颜色选择器的示例代码 的相关文章

随机推荐