Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <style>
    #green {
      background-color: green;
      height: 100px;
      width: 100px;
      margin: 10px;
    }
    #blue {
      background-color: blue;
      height: 100px;
      width: 100px;
      margin: 10px;
    }
  </style>
</head>
<body>
  Move the mouse into the green box and leave it there. Touch the blue box and release. Now slightly move the mouse.
  <div id="green"></div>
  <div id="blue"></div>
  <div id="log"></div>
  <script>
var eventList = ['pointerenter', 'pointerover', 'pointerleave', 'pointerout',
                'mouseenter', 'mouseover', 'mouseleave', 'mouseout'];
    var logDiv = document.getElementById('log');
['green', 'blue'].forEach(function(divName) {
  var divElem = document.getElementById(divName);
  eventList.forEach(function(eventName) {
    divElem.addEventListener(eventName, function(event) {
      var logLine = "";
      if (event.type.startsWith('pointer'))
        logLine = event.type + " (id=" +event.pointerId + ")";
      else
        logLine = event.type;
      logDiv.innerHTML += "<span style='background:" + divName + ";'>" + logLine + " on " + divName +  "</span> <br/>";
    });
  });
});
  </script>
</body>
</html>
Output

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

Dismiss x