diff --git a/public/res/extensions/scrollLink.js b/public/res/extensions/scrollLink.js index 6666186a..39921196 100644 --- a/public/res/extensions/scrollLink.js +++ b/public/res/extensions/scrollLink.js @@ -54,16 +54,19 @@ define([ var htmlSectionOffset; var previewScrollTop = $previewElt.scrollTop(); $previewElt.find(".preview-content > .se-section-delimiter").each(function() { + if(htmlSectionOffset === undefined) { + // Force start to 0 for the first section + htmlSectionOffset = 0; + return; + } var $delimiterElt = $(this); // Consider div scroll position var newSectionOffset = $delimiterElt.position().top + previewScrollTop; - if(htmlSectionOffset !== undefined) { - htmlSectionList.push({ - startOffset: htmlSectionOffset, - endOffset: newSectionOffset, - height: newSectionOffset - htmlSectionOffset - }); - } + htmlSectionList.push({ + startOffset: htmlSectionOffset, + endOffset: newSectionOffset, + height: newSectionOffset - htmlSectionOffset + }); htmlSectionOffset = newSectionOffset; }); // Last section diff --git a/public/res/html/bodyIndex.html b/public/res/html/bodyIndex.html index bc3bf32a..cbb4e232 100644 --- a/public/res/html/bodyIndex.html +++ b/public/res/html/bodyIndex.html @@ -298,7 +298,7 @@