Skip to content

Please consider the parent element style to be relative when page mode is applied. #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
baco16g opened this issue May 7, 2020 · 3 comments
Labels

Comments

@baco16g
Copy link

baco16g commented May 7, 2020

Describe

// in page mode we bind scroll event to document
if (this.pageMode) {
document.addEventListener('scroll', this.onScroll, {
passive: false
})
// taking root offsetTop or offsetLeft as slot header size
const { root } = this.$refs
if (root) {
this.virtual.updateParam('slotHeaderSize', root[this.isHorizontal ? 'offsetLeft' : 'offsetTop'])
}
}
},

To Reproduce

  1. Apply page mode.
  2. Wrap the vue-virtual-scroll-list with an element.
  3. Set margin-top: 300px; and position: relative; to the element.
  4. When scrolling, there is an error in the range switching timing.

Reproduce demo

https://codesandbox.io/s/live-demo-virtual-list-ickof

Other

  • Version: 2.1.9
  • Browser: chrome, safari
@baco16g baco16g added the bug label May 7, 2020
@tangbc
Copy link
Owner

tangbc commented May 7, 2020

OK, I will fix it soon.

@baco16g baco16g changed the title Please tolerate the parent element style to be relative when page mode is applied. Please consider the parent element style to be relative when page mode is applied. May 7, 2020
tangbc added a commit that referenced this issue May 7, 2020
@tangbc
Copy link
Owner

tangbc commented May 7, 2020

Fixed and published in v2.2.0

Here is the latest version forking demo: https://codesandbox.io/s/live-demo-virtual-list-5zmj4

Also, in page mode if offsetTop change (we cannot detect an element position change in browser), you shoud call public mehod updatePageModeFront () to update manually.

@tangbc tangbc closed this as completed May 7, 2020
@baco16g
Copy link
Author

baco16g commented May 7, 2020

Thanks for implementation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants