Create your own pixel art maker
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixel-art-maker/app.js

16 lines
461 B

9 years ago
var brush;
var current = document.querySelector('.current');
var colorField = document.querySelector('#container');
colorField.addEventListener('click', function(event) {
if (event.target.parentNode.id === 'palette-container') {
brush = event.target.style.background;
current.style.background = brush;
} else if (event.target.className === 'pixel') {
event.target.style.background = brush;
event.target.style.borderColor = brush;
}
});