Skip to content

Instantly share code, notes, and snippets.

@tylerthebuildor
Created June 18, 2013 16:31
Show Gist options
  • Save tylerthebuildor/5806949 to your computer and use it in GitHub Desktop.
Save tylerthebuildor/5806949 to your computer and use it in GitHub Desktop.
Adds transparent background to every node in the DOM. Allows for easy collision and overlap inspection. Ctrl-i toggles functionality.
// DOM Highlight (Ctrl-i)
$(function() {
$("<style type='text/css'> .DOMHighlight {background: rgba(0,0,0,0.1);} </style>").appendTo("head");
$('body').keypress(function(e) {
if (e.which === 9)
$('*').toggleClass('DOMHighlight');
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment