Prechádzať zdrojové kódy

fix IE bug where fixed height of view would oscillate

Adam Shaw 11 rokov pred
rodič
commit
00d85a46dc
2 zmenil súbory, kde vykonal 12 pridanie a 3 odobranie
  1. 11 2
      src/common/View.js
  2. 1 1
      src/main.css

+ 11 - 2
src/common/View.js

@@ -121,8 +121,17 @@ View.prototype = {
 	// Given the total height of the view, return the number of pixels that should be used for the scroller.
 	// Utility for subclasses.
 	computeScrollerHeight: function(totalHeight) {
-		// `otherHeight` is the cumulative height of everything that is not the scrollerEl in the view (header+borders)
-		var otherHeight = this.el.outerHeight() - this.scrollerEl.height();
+		var both = this.el.add(this.scrollerEl);
+		var otherHeight; // cumulative height of everything that is not the scrollerEl in the view (header+borders)
+
+		// fuckin IE8/9/10/11 sometimes returns 0 for dimensions. this weird hack was the only thing that worked
+		both.css({
+			position: 'relative', // cause a reflow, which will force fresh dimension recalculation
+			left: -1 // ensure reflow in case the el was already relative. negative is less likely to cause new scroll
+		});
+		otherHeight = this.el.outerHeight() - this.scrollerEl.height(); // grab the dimensions
+		both.css({ position: '', left: '' }); // undo hack
+
 		return totalHeight - otherHeight;
 	},
 

+ 1 - 1
src/main.css

@@ -64,7 +64,7 @@
 /* View Structure
 --------------------------------------------------------------------------------------------------*/
 
-.fc-view-container, /* scope positioning and z-index's for everything within the view */
+.fc-view, /* scope positioning and z-index's for everything within the view */
 .fc-view > table { /* so dragged elements can be above the view's main element */
 	position: relative;
 	z-index: 1;