Created
August 2, 2011 03:22
-
-
Save shurane/1119539 to your computer and use it in GitHub Desktop.
Pull hug.css into current website to use as a grid -- well if I knew where to host the .css file
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
var tempLink = document.createElement("link"); | |
var hugDiv = document.createElement("div"); | |
var columns = 5; | |
tempLink.href = "http://link/to/hug.css"; | |
tempLink.type = "text/css"; | |
hugDiv.id = "hug" | |
leftDiv = document.createElement("div"); | |
leftDiv.className = "mline mlineL"; | |
hugDiv.appendChild(leftDiv); | |
for (i=0; i<columns; i++) | |
{ | |
lineDiv = document.createElement("div"); | |
lineDiv.className = "lineL"; | |
hugDiv.appendChild(lineDiv); | |
} | |
rightDiv = document.createElement("div"); | |
rightDiv.className = "mline mlineR"; | |
hugDiv.appendChild(rightDiv); | |
document.head.appendChild(tempLink); | |
document.body.appendChild(hugDiv); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks shurane! I downloaded and tested via jquery document.ready. In my fork (is this the correct way to work?) I corrected the columns output to match my hand-set code. As a web developer, it's no big deal to download .js and .css files, drop them on your server, add a link and some jquery to page template head. However, now that you've started me down this path (I know very little JavaScript) it would make sense to set certain properties (page width, column count, column width, gutter width) and possibly calculate on the fly via JS. Then the user would not need to set them by opening hug.css and editing.
Thanks!