X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/573b9004c7bc2a6a2b29335155b4ff55d142c6b6..9b533fdbfd08bd764744ae3a0d4717c87b61cf18:/src/redakcja/static/js/wiki/view_annotations.js diff --git a/src/redakcja/static/js/wiki/view_annotations.js b/src/redakcja/static/js/wiki/view_annotations.js index 97479cd0..8e3671ab 100644 --- a/src/redakcja/static/js/wiki/view_annotations.js +++ b/src/redakcja/static/js/wiki/view_annotations.js @@ -32,7 +32,7 @@ } updateAnnotationIds() { - let selt = this; + let self = this; self.annotationToAnchor = {}; $('#html-view').find('.annotation-inline-box').each( function(i, annoBox) { @@ -65,9 +65,10 @@ var anchor = self.annotationToAnchor[content]; if (anchor != undefined) { var $htmlView = $("#html-view"); - var top = $htmlView.offset().top + - $("[name=" + anchor + "]", $htmlView).offset().top - - $htmlView.children().eq(0).offset().top; + var top = $("[name=" + anchor + "]", $htmlView).offset().top - + $htmlView.offset().top + + $htmlView.scrollTop() + ; $htmlView.animate({scrollTop: top}, 250); }