Skip to content

Instantly share code, notes, and snippets.

@shmdhussain
Created January 29, 2018 06:56
Show Gist options
  • Save shmdhussain/f0da910dec9572fa4facfd3cf8ff2a76 to your computer and use it in GitHub Desktop.
Save shmdhussain/f0da910dec9572fa4facfd3cf8ff2a76 to your computer and use it in GitHub Desktop.
In Chrome clicking "h" key in elements tab of devtools panel should toggle the hide/show
var cssRule = `.__web-inspector-hide-shortcut__, .__web-inspector-hide-shortcut__ * {
display: none !important;
}`;
function injectStyleRulejQ(rule, id) {
var div = $("<div />", {
html: '&shy;<style id=' + id + '>' + rule + '</style>'
}).appendTo("body");
div.hide();
}
function injectStyleRule(rule, id) {
var elem = document.createElement('div');
elem.innerHTML = "<style>" + rule + "</style>";
elem.id=id;
elem.style.cssText = 'display:none';
document.body.appendChild(elem);
}
injectStyleRule(cssRule, "display-none-shortcut");
//https://stackoverflow.com/questions/34938460/is-there-a-shortcut-to-toggle-display-none-block-in-elements-style-in-chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment