Permalink
Browse files

fix width calculation

  • Loading branch information...
1 parent fcc236f commit 60f3f5dc90f35695fff087f788d9b3df1557b18b @scoates committed with dotjay Jul 19, 2010
Showing with 9 additions and 2 deletions.
  1. +9 −2 hashgrid.js
View
11 hashgrid.js
@@ -114,16 +114,23 @@ var hashgrid = function(set) {
var overlayVert = overlay.children('.vert-container');
var gridWidth = overlay.width();
overlayVert.css({width: gridWidth, position: 'absolute', top: 0});
- overlayVert.append('<div class="vert first-line">&nbsp;</div>');
+ overlayVert.append('<div class="vert">&nbsp;</div>');
var overlayGridLines = overlayVert.children('.vert');
+ // need to temporarily set this to display: block to get the size
+ overlay.css({visibility: 'hidden', display: 'block'});
var overlayGridLinesWidth = overlayGridLines.outerWidth(true);
+ overlay.css({visibility: 'inherit', display: 'none'});
+ overlayGridLines.addClass('first-line');
numGridLines = Math.floor(gridWidth / overlayGridLinesWidth);
- for (i = 0; i < numGridLines; i++) {
+ // multiply this by two to make sure we have enough lines
+ // (we *could* still run out)
+ for (i = 0; i < numGridLines * 2; i++) {
overlayVert.append('<div class="vert">&nbsp;</div>');
}
+
overlayVert.children()
.height(pageHeight)
.css({display: 'inline-block'});

0 comments on commit 60f3f5d

Please sign in to comment.