mirror of
https://github.com/flarum/framework.git
synced 2024-11-29 04:33:47 +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);
|
|
}
|