1
0
mirror of https://github.com/flarum/core.git synced 2025-02-26 12:15:32 +01:00
php-flarum/js/lib/utils/anchor-scroll.js
2015-05-29 18:17:50 +09:30

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);
}