Skip to content

Instantly share code, notes, and snippets.

@tedgrubb
Last active December 18, 2015 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tedgrubb/5768880 to your computer and use it in GitHub Desktop.
Save tedgrubb/5768880 to your computer and use it in GitHub Desktop.
Self contained 16 column grid overlay. Toggle the overlay by pressing the 'G' key.
$(function() {
$('body').prepend('<div id="grid-overlay" style="display:none;width:100%;height:100%;position:fixed;z-index:99999999;margin-left:-20px;"></div>');
$(new Array(30)).each(function() {
$('#grid-overlay').append('<div style="float:left;width:60px;height:100%;margin-left:20px;background:rgba(255,153,153,0.2);"></div>');
});
keydown_show_grid = function(event) {
if(event.which == 71) {
$('#grid-overlay').toggle();
}
};
$(document).bind('keydown', keydown_show_grid);
$('input, textarea, select').focus(function() {
$(document).unbind('keydown', keydown_show_grid);
});
$('input, textarea, select').blur(function() {
$(document).bind('keydown', keydown_show_grid);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment