Fixed incorrect init calculation of originalPosition attribute
This commit is contained in:
parent
73dd05b01d
commit
7631539584
1 changed files with 7 additions and 1 deletions
|
@ -320,6 +320,8 @@ module.exports = React.createClass({
|
||||||
|
|
||||||
_initAndPositionStickyHeaders: function(initialise, scrollToPosition) {
|
_initAndPositionStickyHeaders: function(initialise, scrollToPosition) {
|
||||||
var scrollArea = this._getScrollNode();
|
var scrollArea = this._getScrollNode();
|
||||||
|
// Use the offset of the top of the scroll area from the window
|
||||||
|
// as this is used to calculate the CSS fixed top position for the stickies
|
||||||
var scrollAreaOffset = scrollArea.getBoundingClientRect().top;
|
var scrollAreaOffset = scrollArea.getBoundingClientRect().top;
|
||||||
var scrollAreaHeight = scrollArea.getBoundingClientRect().height;
|
var scrollAreaHeight = scrollArea.getBoundingClientRect().height;
|
||||||
|
|
||||||
|
@ -335,7 +337,11 @@ module.exports = React.createClass({
|
||||||
if (typeof stickies === "object" && stickies.length > 0) {
|
if (typeof stickies === "object" && stickies.length > 0) {
|
||||||
// Initialise the sticky headers
|
// Initialise the sticky headers
|
||||||
this.stickyWrappers = Array.prototype.map.call(stickies, function(sticky, i) {
|
this.stickyWrappers = Array.prototype.map.call(stickies, function(sticky, i) {
|
||||||
sticky.dataset.originalPosition = sticky.offsetTop - scrollAreaOffset;
|
// Save the positions of all the stickies within scroll area.
|
||||||
|
// These positions are relative to the LHS Panel top
|
||||||
|
sticky.dataset.originalPosition = sticky.offsetTop - scrollArea.offsetTop;
|
||||||
|
|
||||||
|
// Save and set the sticky heights
|
||||||
var originalHeight = sticky.getBoundingClientRect().height;
|
var originalHeight = sticky.getBoundingClientRect().height;
|
||||||
sticky.dataset.originalHeight = originalHeight;
|
sticky.dataset.originalHeight = originalHeight;
|
||||||
sticky.style.height = originalHeight;
|
sticky.style.height = originalHeight;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue