Last active
December 17, 2015 14:49
-
-
Save jiripudil/5627154 to your computer and use it in GitHub Desktop.
Snippet that allows you to inspect elements in Google Chrome Dev Tools with a single click
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('click', function (e) { | |
// the combination can be changed easily | |
// in this case it is Ctrl + Shift + MMB | |
if (e.button == 1 && e.ctrlKey && e.shiftKey) { | |
// fire up Inspector focused on the clicked element | |
inspect(e.target); | |
// prevent default action (e.g. do not click through links) | |
e.preventDefault(); | |
// prevent the event from bubbling further through the DOM | |
e.stopImmediatePropagation(); | |
} | |
// true - capture the event in the initial phase of event flow | |
}, true); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment