Reorganize depot models in preparation for more.
[redakcja.git] / src / redakcja / static / js / wiki / view_annotations.js
index 97479cd..8e3671a 100644 (file)
@@ -32,7 +32,7 @@
         }
 
         updateAnnotationIds() {
         }
 
         updateAnnotationIds() {
-            let selt = this;
+            let self = this;
             self.annotationToAnchor = {};
             $('#html-view').find('.annotation-inline-box').each(
                 function(i, annoBox) {
             self.annotationToAnchor = {};
             $('#html-view').find('.annotation-inline-box').each(
                 function(i, annoBox) {
             var anchor = self.annotationToAnchor[content];
             if (anchor != undefined) {
                 var $htmlView = $("#html-view");
             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);
             }
 
                 $htmlView.animate({scrollTop: top}, 250);
             }