JQuery调色板 插件

来源:互联网 发布:淘宝贷款不还会怎样 编辑:程序博客网 时间:2024/06/05 16:44

官网:http://acko.net/dev/farbtastic

用法:

下载Farbtastic 1.2.zip

1、首先要在页面引用JQuery,然后在页面引用farbtastic.js和farbtastic.css(Include farbtastic.js and farbtastic.css in your HTML):

<script type="text/javascript" src="farbtastic.js"></script>

<link rel="stylesheet" href="farbtastic.css" type="text/css" />

2、在页面放一个文本框和一个DIV,asp.net可以放一个服务端的文本框,这样我们就可以在后台取到前台设置的颜色了(Add a placeholder div and a text field to your HTML, and give each an ID):

<form><input type="text" id="color" name="color" value="#123456" /></form>

<div id="colorpicker"></div>

3、用以下代码在页面注册ready事件,将第二步建立的DIV和文本框的ID放到以下红色部分,注意语法。(Add a ready() handler to the document which initializes the color picker and link it to the text field with the following syntax):

<script type="text/javascript">

  $(document).ready(function() {

    $('#colorpicker').farbtastic('#color');

  });

</script>

做好这三步,我们就可以使用这个很方便的调色板了,无聊的时候还可以当小游戏来玩一下。。。 


原创粉丝点击