jquery / jquery/api.jquery.com

scrollLeft() does not always return an Integer

Open
#1,198 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
HTML
Stars
325
Forks
260
PR merge metrics
No merged PRs in 30d

Description

Documentation issue: scrollLeft can return a Double in Chrome (tested in Chrome 96) and Edge.

Repro by changing the zoom level and scrolling horizontally.
https://jsfiddle.net/d6u2sjth/4/

MDN says: "Warning: On systems using display scaling, scrollLeft may give you a decimal value"
https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollLeft

See also: https://github.com/jquery/api.jquery.com/issues/608

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the jQuery API documentation entry for scrollLeft and compare its return-value description with the linked MDN guidance and Chrome/Edge behavior. Update the documentation to note that horizontal scrolling can produce decimal values under display scaling or zoom; the issue is done when this behavior is accurately documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.