Coder Social home page Coder Social logo

Comments (5)

ashthornton avatar ashthornton commented on June 4, 2024 1

Hi @richard-unterberg , without seeing your full setup I think the best way to do what you're asking is to explicitly set the target scroll position as well as the current smoothed scroll position like so:

ASScroll.Scroll.scrollPos = y
ASScroll.Scroll.smoothScrollPos = y

y would need to be the negative value of the position you want to scroll to

I think I will add a method to do this without manually changing values in the future since I've needed to do this before as well.

from asscroll.

richard-unterberg avatar richard-unterberg commented on June 4, 2024 1

absolutely awesome. works for me <3

(I´ll submit the finished site to your showcase later this year)

from asscroll.

MathieuMart avatar MathieuMart commented on June 4, 2024

Hi @ashthornton , thanks for this libs !

I'm using nuxt and my usecase it's transition between two pages.

I would like to go to the top of my page without smooth, but this code it's obseleted
ASScroll.Scroll.scrollPos = y ASScroll.Scroll.smoothScrollPos = y

And currentPos & targetPos are protected by the getters

Do you have a method or code ?

EDIT:

I find this method and it works, what do you think ?
ASScroll.controller.applyTransform(0, 0)

from asscroll.

ashthornton avatar ashthornton commented on June 4, 2024

Hi @MatHackDev, if you're using v2 you should be able to just set asscroll.currentPos = 200 for example, as outlined in the docs here. Does this not work for you?

from asscroll.

MathieuMart avatar MathieuMart commented on June 4, 2024

Thanks for the quick answer :)

I had to change my way of doing things in my transition beceause currentPos apply after enable()

Edit: i just change position of my new enable({ reset: true }) ... it's works... sorry

But it's works now ! Thanks.

from asscroll.

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.