我已经看到许多网站,其中包含一个颜色开关,用户可以选择/选择任何颜色,整个页面将相应改变。下面是几个例子链接..。
http://csmthemes.com/themes/beta/static/
http://magna-themes.com/demos/html/flatapp/index.htm
http://envato.nestolab.com/Batekh/style-1/image-slider-version/index-one-page.html
http://ronseta.com/Roof/index_02.html我想要什么:我想要相同的配色方案,但问题是,我是一个自己创造它的专家,所以我想要基本的逻辑和一些代码开始,我有一个基本的知识,JavaScript和jQuery。如果有任何与此相关的免费插件,那么请共享链接,或者分享一些代码,通过这些代码我可以开始构建自己的插件。
发布于 2015-03-22 22:56:50
这是一个非常简单的解决方案,我把它组合在一起,我认为它可以完成我认为你想要完成的任务。
HTML
<h1>Color Picker</h1>
<input type='text' class="colorPicker"/>JS
$(".colorPicker").spectrum({
color: "#ff0000",
change: function(color) {
// convert the color output to a usable hex format
color = color.toHexString();
// set the css of your target element to the chosen color
$("body").css({"background-color":color});
}
});http://jsfiddle.net/edhebert/tbptwz67/
在这个演示中,我使用的是光谱颜色选择器。这是一个免费的,非常容易使用的插件,可在https://bgrins.github.io/spectrum/上使用
我使用的是一个非常基本的颜色选择器,但是频谱有各种各样的定制选项。
希望这能有所帮助。
https://stackoverflow.com/questions/29037627
复制相似问题