Created
May 20, 2011 20:40
-
-
Save mcheck/983751 to your computer and use it in GitHub Desktop.
js to toggle the blueprint grid
This file contains 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).ready(function() { | |
$("body").append("<div id='debug'>turn grid: <a href='' id='togglegrid'>" + gridstate() + "</a></div>"); | |
$("#debug").css("position", "absolute"); | |
$("#debug").css("bottom", "0"); | |
$("#togglegrid").click(toggle_grid); | |
}); | |
function toggle_grid () { | |
$(".container").toggleClass("showgrid"); | |
$("#togglegrid").text(gridstate()); | |
return false; | |
} | |
function gridstate () { | |
if ($(".container").hasClass("showgrid")) { | |
return 'off'; | |
} else { | |
return 'on'; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use to toggle the blueprint grid.
Just include in app controller views: <%= javascript_include_tag 'blueprint_showgrid.js' %>