Skip to content

Instantly share code, notes, and snippets.

@Dayjo
Created July 27, 2014 19:56
Show Gist options
  • Save Dayjo/511a41346161aa9177ea to your computer and use it in GitHub Desktop.
Save Dayjo/511a41346161aa9177ea to your computer and use it in GitHub Desktop.
#inspector {
background: rgba(0,0,255,0.9);
}
<!DOCTYPE html>
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<div id="inspector"></div>
<body>
</body>
</html>
$(function(){
$('body').before('<div id="inspector"></div>');
$("*:not(#inspector)").hover(function (e) {
var p = $(this).position();
var height = this.offsetHeight + 'px';
var width = this.offsetWidth + 'px';
$('#inspector').css({
left: p.left,
top: p.top,
right: p.right,
bottom: p.bottom,
width: width,
height: height
});
});
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment