Skip to content

Instantly share code, notes, and snippets.

View levilansing's full-sized avatar

Levi Lansing levilansing

View GitHub Profile
@levilansing
levilansing / README.md
Last active March 6, 2017 10:18 — forked from jocki84/README.md
scrollIntoViewIfNeeded 4 everyone!!!

Polyfill for scrollIntoViewIfNeeded()

This gist provides polyfill code for the scrollIntoViewIfNeeded() Element method found on WebKit browsers.

Features

There is no particular requirement on the position in the hierarchy of the element being made visible with respect to any scrollable areas. Elements that are relatively positioned as well as nested scrollable areas are both supported.

CoffeeScript version added with an optional offset for scrolling past fixed headers, etc