feat: add missing topOffset and leftOffset props to scroll-into-view Alignment (#35428)

This commit is contained in:
Thibaut Fatus 2019-05-14 23:35:27 +02:00 committed by Nathan Shively-Sanders
parent c8865c4fa2
commit 81fc741f8d
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,7 @@
// Type definitions for scroll-into-view 1.6.0
// Project: https://github.com/KoryNunn/scroll-into-view
// Definitions by: zivni <https://github.com/zivni>
// Thibaut <https://github.com/Thibaut-Fatus>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module __ScrollIntoView {
@ -17,6 +18,10 @@ declare module __ScrollIntoView {
top?: number
/** 0 to 1, default 0.5 (center) */
left?: number
/** pixels to offset top alignment */
topOffset?: number
/** pixels to offset left alignment */
leftOffset?: number
}
/** type will be 'complete' if the scroll completed or 'canceled' if the current scroll was canceled by a new scroll */

View File

@ -13,11 +13,13 @@ scrollIntoView(someElement, {
},
align: {
top: 0,
left: 1
left: 1,
topOffset: 20,
leftOffset: 20
}
});
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
});
});