-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
fix: initialize progress value with init scroll #288
base: main
Are you sure you want to change the base?
Conversation
Run & review this pull request in StackBlitz Codeflow. |
✅ Deploy Preview for cientos-tresjs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
@@ -112,21 +111,21 @@ watch( | |||
}, | |||
) | |||
|
|||
watch(windowY, (value) => { | |||
if (!isScrolling.value && !props.htmlScroll) return | |||
function updateScroll(value: number) { | |||
progressScroll.value = (value / height.value / (scrollNodeY.value / height.value - 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this working for horizontal axis??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works! This is a welcome improvement.
I'm approving since the fix works, but I noticed this related bug.
Bug: linking to named anchors
Reproduction
Example markup
<a href="#two">Jump to section 2</a>
<section><h1>Section 1</h1></section>
<section><h2 id="#two">Section 2</h2></section>
- In the text editor, insert the example markup into the playground/src/pages/controls/ScrollControlsDemo.vue and save.
- On the command line, start the playground with
pnpm run playground
if not already running. - In the browser, open a new, blank tab.
- In the browser, paste
http://localhost:5173/controls/scroll-controls#two
in the address bar and hitEnter
.
Expected behavior
The page should scroll to the second header.
Behavior
The page loads and remains at y-offset 0.
Once the page is loaded, clicking on "Jump to section 2" works as expected.
Tested in Chrome, FF, Safari on Mac.
Would you like this to be opened as a separate issue or worked on here?
Hi @andretchen0 thanks for the help, yes let's open it on a separate issue to focus on anchors |
This PR fixes the issue with the progress value being always 0 even if the page is refreshed after scrolling to a certain position. (Astro)