LOADING...

Preview

Pen ID
Unlock Campus Themeforest adv

 

Code


    
    Pixel Art Maker!
    
    


    

Lab: Pixel Art Maker

Choose Grid Size

Grid Height: Grid Width:

Pick A Color

Design Canvas

CSS
body {
  text-align: center;
  background-color: #bbb;
  color: #1E2D0C;
}
input[type=submit]{
    font-family: '5by7Regular'; 
  font-size: 20px;
  border-radius: 8px;
}
#refresh {
    font-family: '5by7Regular'; 
    font-size: 20px;
	border-radius: 8px;
}

h1 {
  font-family: '5by7Regular'; 
  font-size: 70px;
  margin: 0.2em;
  color: orange;
}

h2 {
  font-family: '5by7Regular'; 
  font-size: 20px;
  margin: 1em 0 0.25em;
}

h2:first-of-type {
  margin-top: 0.5em;
}

table, tr, td {
  border: 1px solid #1E2D0C;
}

table {
  border-collapse: collapse;
  margin: 0 auto;
}

tr {
  height: 20px;
}
form {
  font-family: '5by7Regular'; 
  font-size: 20px;
  color: yellow;
}


td {
  width: 20px;
}

input[type=number] {
  width: 6em;
  background-color: #f1f1f1;
}

#buttons {
 
  
  padding-top: 25px;
}
JS
function makeGrid() {
  var dcRows = $("#input_height").val();
  var dcCols = $("#input_width").val();
  var dcTable = $("#pixel_canvas");
  dcTable.children().remove(); 
  for (var row = 0; row < dcRows; row++) {
    dcTable.append("");
    for (var col = 0; col < dcCols; col++) {
      dcTable.children().last().append("");
    }
  }
  
  dcTable.on("click", "td", function() {
    var color = $("input[type='color']").val();
      $(this).attr("bgcolor", color);
  });
}

$("input[type='submit']").click(function(creation) {
  creation.preventDefault();
  makeGrid();
});

$('#refresh').click(function() {
    location.removedByCodePen();
});
Wed, 12/27/2017 - 07:03

Related Codes

Pen ID
Pen ID
Pen ID
Square Adv