Следующий код работает только с prototype.js, но не работает с jquery. Как я могу изменить этот код, чтобы он работал с последней версией jquery?Код работает с prototype.js, но не с библиотекой jquery
var colors = [ 'feff35','fff600','ffe800','d0eb2c','aed14f','40aa48' ];
colors.each(function (color) {
$$('.color-picker-bg')[0].insert('<div class="square" style="background: #' + color + '"></div>');
});
$$('.color-picker-bg')[0].on('click', '.square', function (event, square) {
background = square.getStyle('background');
$$('.bg').each(function (backgroundx) {
backgroundx.setStyle({ 'background': background });
});
});
.square {
width: 31.25px;
height: 31.25px;
float:left;
cursor:pointer;
\t text-align:center;
}
.square:hover::before{font-family:FontAwesome;content:"\f111";color:#fff;line-height: 31.25px;font-size:12px}
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js"></script>
<div class="color-picker-bg"></div>
<div class="bg">content</div>
Вы можете оставить свой HTML-код? или создать jsfiddle? –
Я разместил все. Спасибо. – ercan