Skip to content

Commit

Permalink
Merge pull request jmosbech#60 from robertbrooker/master
Browse files Browse the repository at this point in the history
fix border-collapse issue
  • Loading branch information
jmosbech committed May 27, 2014
2 parents beff52a + 1552c6b commit a5124cf
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion js/jquery.stickytableheaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,19 @@
if ($this.css('box-sizing') === 'border-box') {
width = $this.outerWidth(); // #39: border-box bug
} else {
width = $this.width();
var $origTh = $('th', base.$originalHeader);
if ($origTh.css('border-collapse') === 'collapse') {
if (document.defaultView && document.defaultView.getComputedStyle) { // standard (includes ie9)
width = parseFloat(document.defaultView.getComputedStyle(this, null).width);
} else {
var leftPadding = parseFloat($this.css("padding-left"));
var rightPadding = parseFloat($this.css("padding-right"));
var border = parseFloat($this.css("border-width")); //Needs more investigation - this is assuming constant border around this cell and it's neighbours.
width = $this.outerWidth() - leftPadding - rightPadding - border;
}
} else {
width = $this.width();
}
}

widths[index] = width;
Expand Down

0 comments on commit a5124cf

Please sign in to comment.