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

trotzig / diffux / 205 / 2
98%
master: 99%

Build:
Build:
LAST BUILD BRANCH: animations
DEFAULT BRANCH: master
Ran 27 Feb 2014 05:19AM UTC
Files 25
Run time –
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

27 Feb 2014 05:08AM UTC coverage: 97.528%. Remained the same
2.1.0

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%)

26.24 hits per line

Source Files on job 205.2 (2.1.0)
  • Tree
  • List 0
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 205
  • Travis Job 205.2
  • 2a5ef90a on github
  • Prev Job for 2.1.0 on better-nav-scroll (#203.2)
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

© 2026 Coveralls, Inc