Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.1/processing-api.min.js"></script>
<!DOCTYPE html>
<html>
<head>
  <script class="jsbin" src="http://code.jquery.com/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
  <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
  article, aside, figure, footer, header, hgroup, 
  menu, nav, section { display: block; }
</style>
</head>
<body>
  <div id="track" style="height:200px; width:200px; background:#ddd;">Tracking</div>
  <div id="status"></div>
</body>
</html>
 
// Setup
jQuery.fn.tracking = function () {
  this.data('hovering', false);
  
  this.hover(function () {
    $(this).data('hovering', true);
  }, function () {
    $(this).data('hovering', false);
  });
  
  return this;
};
jQuery.fn.hovering = function () {
  return this.data('hovering');
}
// Usage
  
$('#track').tracking();
setInterval(function () {
  $('#status').text(
    'Hovering: ' + $('#track').hovering()
  );
}, 100);
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers