mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-12 16:14:25 +03:00
7a56ded8d0
Merged About and What's new? page.
14 lines
506 B
JavaScript
14 lines
506 B
JavaScript
import getScrollParent from 'ghost-admin/utils/get-scroll-parent';
|
|
import {modifier} from 'ember-modifier';
|
|
|
|
export default modifier((element, positional, {shouldScroll = true}) => {
|
|
if (shouldScroll) {
|
|
// setTimeout needed to ensure layout has finished and we have accurate
|
|
setTimeout(() => {
|
|
const scrollParent = getScrollParent(element);
|
|
const y = element.offsetTop;
|
|
scrollParent.scrollTo({top: y, behavior: 'smooth'});
|
|
}, 200);
|
|
}
|
|
});
|