vitalif / dynamic-virtual-scroll Goto Github PK
View Code? Open in Web Editor NEWRender-agnostic Dynamic Virtual Scroll Driver for JS
Render-agnostic Dynamic Virtual Scroll Driver for JS
If it isnt too much to ask, could you add a sample of how this library is used with Vue.js
Hello,
I'm working on a Vue implementation of your library. (I will open source it later)
It's going pretty well in a container, but i'm trying to achieve the same behaviour in the full page, where the body is the viewport
and the scroll event listener is attached to window
.
I'm calling virtualScrollDriver
like this :
const bounds = document.querySelector("body").getBoundingClientRect();
const scrollTop = -bounds.top;
const viewportHeight = window.innerHeight;
const newState = virtualScrollDriver(
{
totalItems: this.items.length,
minRowHeight: 100,
viewportHeight: viewportHeight,
scrollTop: scrollTop,
},
this.scrollerState,
this.getRenderedItemHeight
);
It works well, until you have DOM elements in the body, before the list.
For example here, I have a <pre>
tag before the list, and it disturbs the virtual scroll behaviour.
If you remove the <pre>
tag (or change it's position to fixed) it fixes the bug.
You can play with the code here (it can take a while to load) :
https://codesandbox.io/s/flamboyant-easley-ix9pe?file=/src/App.vue
How would you implement the full page mode when the list is not the only item the body
?
Also, not related to the full page mode, before any scroll happen, the lastItems are displayed:
Thanks for your help.
Could you add sample using Angular please? Thanks!
Error: Maximum update depth exceeded.
This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate.
React limits the number of nested updates to prevent infinite loops.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.