Giter Site home page Giter Site logo

Comments (5)

ayamflow avatar ayamflow commented on August 30, 2024

Hello!
Thanks for the feedback.

1 - I'll think about adding demos for common use cases.
2 - it's up to you to smooth or not the scroll delta. By default it just copies what the mouse is sending.
3 - I have not used ScrollTrigger, but after a quick look at the docs it looks like you should be able to set the ScrollTrigger scroll value to sync with your virtual-scroll. Something like ScrollTrigger.scroll(y) where y is your virtual-scroll value.
4 - I am not sure what you mean - each page should have their own virtual-scroll instance, not a global one for the whole site. You can also enable/disable each instance by calling .on/.off

from virtual-scroll.

ashehzadgec avatar ashehzadgec commented on August 30, 2024

Thanks for replying back. Here is my reply with reference to the points above in your reply.

2- How I can enable smooth?.
4- I was talking about ajax page loading or single-page application using routers. And in that case, I will have to destroy the current page scroll instance and then reinitiate the scroll instance when the next page dom is loaded or in the second scenario, I will just update the scroll instance when the next page dom is loaded. I hope that makes sense but in either situation, I don't see the options in docs for the scroll.update() or destroy, etc like locomotive scroll is doing.

I love smooth scroll and I have some libs in my code cupboards and that's the reason I gave yours a try and gave my feedback to you.

Regards,
ShehzadAsif
https://www.shehzadasif.com/

from virtual-scroll.

ayamflow avatar ayamflow commented on August 30, 2024

To smooth the scroll value, you can use a simple easing like so:

const scroller = new VirtualScroll()
let smoothY = 0
scroller.on(event => {
    smoothY += (event.y - smoothY) * 0.1;
    wrapper.style.transform = `translateY(${smoothY}px)`
})

There is a .destroy() method that you can call when destroying the current page. Then create a new virtual-scroll for the new page.

from virtual-scroll.

ashehzadgec avatar ashehzadgec commented on August 30, 2024

from virtual-scroll.

dzcpy avatar dzcpy commented on August 30, 2024

Does it work well?

from virtual-scroll.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.