Merge pull request #2407 from SergioCrisostomo/fix-look-for-parent
don't check past document.body when moving up DOM tree
This commit is contained in:
commit
1d15cbbced
1 changed files with 7 additions and 7 deletions
|
@ -239,8 +239,8 @@
|
||||||
if (!currentOffset) return;
|
if (!currentOffset) return;
|
||||||
|
|
||||||
let newOffset = currentOffset > containerWidth
|
let newOffset = currentOffset > containerWidth
|
||||||
? currentOffset - containerWidth
|
? currentOffset - containerWidth
|
||||||
: 0;
|
: 0;
|
||||||
|
|
||||||
this.setOffset(newOffset);
|
this.setOffset(newOffset);
|
||||||
},
|
},
|
||||||
|
@ -251,16 +251,16 @@
|
||||||
if (navWidth - currentOffset <= containerWidth) return;
|
if (navWidth - currentOffset <= containerWidth) return;
|
||||||
|
|
||||||
let newOffset = navWidth - currentOffset > containerWidth * 2
|
let newOffset = navWidth - currentOffset > containerWidth * 2
|
||||||
? currentOffset + containerWidth
|
? currentOffset + containerWidth
|
||||||
: (navWidth - containerWidth);
|
: (navWidth - containerWidth);
|
||||||
|
|
||||||
this.setOffset(newOffset);
|
this.setOffset(newOffset);
|
||||||
},
|
},
|
||||||
getCurrentScrollOffset() {
|
getCurrentScrollOffset() {
|
||||||
const { navStyle } = this;
|
const { navStyle } = this;
|
||||||
return navStyle.transform
|
return navStyle.transform
|
||||||
? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1])
|
? Number(navStyle.transform.match(/translateX\(-(\d+(\.\d+)*)px\)/)[1])
|
||||||
: 0;
|
: 0;
|
||||||
},
|
},
|
||||||
setOffset(value) {
|
setOffset(value) {
|
||||||
this.navStyle.transform = `translateX(-${value}px)`;
|
this.navStyle.transform = `translateX(-${value}px)`;
|
||||||
|
@ -313,7 +313,7 @@
|
||||||
},
|
},
|
||||||
isInsideHiddenElement () {
|
isInsideHiddenElement () {
|
||||||
let parentNode = this.$el.parentNode;
|
let parentNode = this.$el.parentNode;
|
||||||
while(parentNode) {
|
while(parentNode && parentNode !== document.body) {
|
||||||
if (parentNode.style.display === 'none') {
|
if (parentNode.style.display === 'none') {
|
||||||
return parentNode;
|
return parentNode;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue