重置Jquery颜色选择器输出样式
我如何添加删除/重置重置按钮? 当我点击一种颜色,添加一个背景风格到.class-bg,我想重置/删除这个样式与重置按钮?
$(document).ready(function () {
var colors = ['feff35','fff600','ffe800','d0eb2c','aed14f','40aa48','71cde3'];
$ClassBg = $('.color-class-bg'), $stageClassBg = $('.class-bg'),
$.each(colors, function (i, color) { $ClassBg.append('<div class="color-square" style="background:#' + color + ';"></div>'); });
$ClassBg.on('click', '.color-square', function (event) { $stageClassBg.css('background', $(this).css('backgroundColor')); });
});
.color-square{display:inline-block;width:28.75px;height:28.75px;margin: 0 0 -3px 0;cursor:pointer;text-align:center;transition: .1s ease;}
.color-square:hover{box-shadow:0 5px 20px rgba(0, 0, 0, 0.8);transform: translateY(0px) scale(1.70);}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<p class="color-class-bg"></p>
<p class="class-bg">CONTENT</p>
<a href="#" class="reset">reset style</a>
链接地址: http://www.djcxy.com/p/94887.html
上一篇: Reset Jquery Color Picker Output Styles
下一篇: When use backspace or delete button submit button color not changes