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

251
Views
Why does ScrollTo() not accept a top value of Number.POSITIVE_INFINITY?

I noticed the following:

  • In Chrome, using scrollTo on an element with top set to Number.POSITIVE_INFINITY or Number.MAX_VALUE cause the element to scroll to the top. It is only possible to make the element scroll to the bottom by using a number such as Number.MAX_SAFE_INTEGER. I also tried Number.MAX_SAFE_INTEGER + 1000 and it also worked.
  • In Safari, Number.MAX_SAFE_INTEGER and Number.MAX_VALUE both worked to scroll to the bottom, but Number.POSITIVE_INFINITY also scrolled to the top.
  • In Firefox, the behavior is the same as Safari.

This has been tested on macOS.

Anyway, I'm curious why POSITIVE_INFINITY won't work, and why MAX_VALUE also won't work for Chrome I suppose some source code spelunking would easily reveal the answer. I wonder if the spec has anything to say about it, but the inconsistency in implementations would indicate that maybe it's not rigorously defined.

about 4 years ago · Santiago Trujillo
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!