Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
Svelte can't find .ScrollTop of a variable

Hello I have an element which is being referenced to the script like this

<div bind:this={AboutMeAnimation} />

and then In my script I console log ScrollTop value

    let AboutMeAnimation;
    console.log(AboutMeAnimation.ScrollTop);

and for some resson I'm getting an error can some one tell me why?enter image description here

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

A couple of issues, the first is that is scrollTop with a lowercase “s”, the other is that the element does not bind immediately so if you are putting this statement at the top level of the component it will be undefined for some period of time. You can use onMount or similar to get this value:

onMount(() => {
  console.log(AboutMeAnimation.scrollTop);
});

Otherwise a reactive statement could work also:

$: {
  console.log(AboutMeAnimation && AboutMeAnimation.scrollTop);
}

Hopefully that helps!

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!