Hey all. I've added jQuery colorPicker to my webpage and I'm trying to implement the forth example of it. You can find it on this page.
http://www.eyecon.ro/colorpicker/#about
After my implementation, everything works except for the options added in the colorPicker. I can't change the standard color and onShow, onHide & onChange never fires.
Can anyone see why?
Here's my code:
jQuery('document').ready(function(){
$('#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) {
$('#colorSelector div').css('backgroundColor', '#' + hex);
}
});
});
And here's the rest of the code implemented:
<div class="settings-color"><div id="colorSelector"></div></div>
Added scripts:
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
google.load("jquery", "1.4.2");
google.load("swfobject", "2.2");
swfobject.embedSWF("signaturetool.swf", "tool", "490", "700", "9.0.0", "expressInstall.swf", null, {allowScriptAccess: "always", align: "middle"}, {id: "signaturetool", name: "signaturetool"});
-->
开发者_Python百科<script type="text/javascript" src="js/eye.js"></script>
<script type="text/javascript" src="js/utils.js"></script>
<script type="text/javascript" src="js/layout.js?ver=1.0.2"></script>
I've tried with both jQuery 1.3.2 and jQuery 1.4.2. I've also tried with removing swfobject for a while and other css options. It all seems to fail, why?
For the onChange method, it tries to apply style rules to $('#colorSelector div')
, which doesn't exist in your html.
For other methods, I guess they still fires, just you don't feel it.
The right settings was in the layout.js-file and that's why it didn't respond on the index.php-file. When I applied my functions in the layout.js everything worked.
精彩评论