# HG changeset patch # User neko259 # Date 2016-01-10 19:42:38 # Node ID 35599bce43defba5fbf78c43e51cceea6af64b31 # Parent 9b27514898bc36facd642b578545e5f411f476ce Show notifications directly above the reflink unrelated to the cursor position diff --git a/boards/static/js/refpopup.js b/boards/static/js/refpopup.js --- a/boards/static/js/refpopup.js +++ b/boards/static/js/refpopup.js @@ -46,8 +46,9 @@ function addRefLinkPreview(node) { function showPostPreview(e) { var doc = document; - //ref id - var pNum = $(this).text().match(/\d+/); + + var reflink = $(this); + var pNum = reflink.text().match(/\d+/); if (pNum == null || pNum.length == 0) { return; @@ -57,8 +58,8 @@ function showPostPreview(e) { if (post.length > 0 && isElementInViewport(post)) { post.addClass('highlight'); } else { - var x = e.clientX + (doc.documentElement.scrollLeft || doc.body.scrollLeft) + 2; - var y = e.clientY + (doc.documentElement.scrollTop || doc.body.scrollTop); + var x = reflink.offset().left; + var y = reflink.offset().top; var cln = doc.createElement('div'); cln.id = 'pstprev_' + pNum;