Last active
December 18, 2015 10:29
-
-
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.
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
$(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