mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:41:49 +08:00
8 lines
209 B
JavaScript
8 lines
209 B
JavaScript
export default function anchorScroll(element, callback) {
|
|
var scrollAnchor = $(element).offset().top - $(window).scrollTop();
|
|
|
|
callback();
|
|
|
|
$(window).scrollTop($(element).offset().top - scrollAnchor);
|
|
}
|