Skip to content

Commit

Permalink
can't calculate the number of vertical divs in Safari and Chrome (mar…
Browse files Browse the repository at this point in the history
…gin assumes the rest of the block), so solving this with brute force.
  • Loading branch information
scoates authored and dotjay committed Jul 26, 2010
1 parent 6122991 commit ced4693
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions hashgrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,20 +114,11 @@ 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">&nbsp;</div>');
overlayVert.append('<div class="vert first-line">&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);

// multiply this by two to make sure we have enough lines
// (we *could* still run out)
for (i = 0; i < numGridLines * 2; i++) {
// 30 is an arbitrarily large number...
// can't calculate the margin width properly
for (i = 0; i < 30; i++) {
overlayVert.append('<div class="vert">&nbsp;</div>');
}

Expand Down

0 comments on commit ced4693

Please sign in to comment.