Files
DefinitelyTyped/types/scroll-into-view/scroll-into-view-tests.ts
2017-03-24 14:27:52 -07:00

23 lines
654 B
TypeScript

import * as scrollIntoView from "scroll-into-view"
var someElement: HTMLElement
scrollIntoView(someElement);
scrollIntoView(someElement, {
time: 500, // half a second
ease: function (value) {
return Math.pow(value, 2) - value; // Do something weird.
},
validTarget: function (target, parentsScrolled) {
return parentsScrolled < 2 && !target.matches('.dontScroll');
},
align: {
top: 0,
left: 1
}
});
scrollIntoView(someElement, function (type) {
// Scrolling done.
// type will be 'complete' if the scroll completed or 'canceled' if the current scroll was canceled by a new scroll
});