• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

trotzig / diffux
98%
master: 99%

Build:
Build:
LAST BUILD BRANCH: animations
DEFAULT BRANCH: master
Repo Added 05 Feb 2014 08:14PM CUT
Files 32
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

LAST BUILD ON BRANCH better-nav-scroll
branch: better-nav-scroll
CHANGE BRANCH
x
Reset
  • better-nav-scroll
  • animations
  • better-diffs
  • faster-comparer
  • i18n
  • master
  • simple-setup
  • slideshow
  • snapshot_comparison_image

pending completion
205

push

travis-ci

trotzig
Only scroll when necessary on keyboard navigation

This commit replaces the previous usage of the native JS function
`scrollIntoView` with a jQuery solution instead. The new solution:

- Only scrolls when the focused element is hidden.
- Keeps 1/4 of the screen above the focused element (for context).
- Animates the scroll (this improved the experience by *a lot*, because
  you can see exactly what happens)

To figure out if an element is shown on the screen or not, I'm using the
`jquery.visible` Bower plugin. I tried out a couple of alternatives that
did scrolling, but both `jquery.scrollIntoView` (buggy) and
`jquery.scrollTo` (didn't avoid scrolling if it wasn't needed) came in
short.

An important detail about the animation: The previous animation is
cancelled (`stop()`ed) before the next is started. This is important in
order to allow people hammering/holding down j/k.

Why scroll both 'html' and 'body'? Well, 'body' works for Chrome, and
'html' works for Firefox. Even though we don't care much about browser
compatibility, I think Firefox users deserve to get scrolling
functionality. @ted27 will at least thank me (I hope).

434 of 445 relevant lines covered (97.53%)

52.48 hits per line

Relevant lines Covered
Build:
Build:
445 RELEVANT LINES 434 COVERED LINES
52.48 HITS PER LINE
Source Files on better-nav-scroll
  • List 0
  • Changed 1
  • Source Changed 0
  • Coverage Changed 1
Loading...
Coverage∆FileLinesRelevantCoveredMissedHits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
205 better-nav-scroll Only scroll when necessary on keyboard navigation This commit replaces the previous usage of the native JS function `scrollIntoView` with a jQuery solution instead. The new solution: - Only scrolls when the focused element is hidden. - Keeps 1/4... push 27 Feb 2014 05:19AM CUT trotzig travis-ci pending completion  
203 better-nav-scroll Only scroll when necessary on keyboard navigation This commit replaces the previous usage of the native JS function `scrollIntoView` with a jQuery solution instead. The new solution: - Only scrolls when the focused element is hidden. - Keeps 1/4... push 24 Feb 2014 04:48AM CUT trotzig travis-ci pending completion  
202 better-nav-scroll Only scroll when necessary on keyboard navigation This commit replaces the previous usage of the native JS function `scrollIntoView` with a jQuery solution instead. The new solution: - Only scrolls when the focused element is hidden. - Keeps 1/4... push 24 Feb 2014 04:21AM CUT trotzig travis-ci pending completion  
See All Builds (276)
  • Repo on GitHub
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc