Fix PostStream endless loading due to broken scroll anchor

This commit is contained in:
Toby Zerner 2015-07-22 09:55:20 +09:30
parent f59e14db3e
commit 3e4b30695e

View File

@ -12,11 +12,10 @@
* @param {Function} callback The callback to run that will change page content.
*/
export default function anchorScroll(element, callback) {
const $element = $(element);
const $window = $(window);
const relativeScroll = $element.offset().top - $window.scrollTop();
const relativeScroll = $(element).offset().top - $window.scrollTop();
callback();
$window.scrollTop($element.offset().top - relativeScroll);
$window.scrollTop($(element).offset().top - relativeScroll);
}