Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width">
<script src="https://code.jquery.com/pep/0.3.0/pep.js"></script>
<script src="https://code.jquery.com/jquery-1.11.3.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
<div id="canvas" touch-action="none"></div>
</body>
</html>
 
.pixel {
  position: absolute;
  background: black;
  width: 2px;
  height: 2px;
}
#canvas {
  margin: 20px;
  background: white;
  border: 1px solid black;
  height: 200px;
}
 
function draw(where) {
  $("<div>").addClass("pixel").appendTo("#canvas").css({
    left: where.pageX,
    top: where.pageY
  });
}
$("#canvas").on("pointermove", function(event) {
  draw(event);
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers