correct notice tags display when scrolling
authorymh <ymh.work@gmail.com>
Mon, 30 Mar 2015 19:14:11 +0200
changeset 596 86b5386a7bfd
parent 595 e0568837bfe9
child 597 a6ed76e9d5d5
correct notice tags display when scrolling
src/hdalab/static/hdalab/js/notice.js
--- a/src/hdalab/static/hdalab/js/notice.js	Mon Mar 30 19:09:47 2015 +0200
+++ b/src/hdalab/static/hdalab/js/notice.js	Mon Mar 30 19:14:11 2015 +0200
@@ -3,9 +3,12 @@
 function drawlinks() {
     var w$ = $(window)
         scroll = w$.scrollTop(),
-        windowheight = w$.height();
+        windowheight = w$.height(),
+        headerheight = $("#content").position().top,
+        datasheetheight = Math.max($(".tags-main").outerHeight(),$(".main-datasheet").outerHeight()),
+        scrollval = Math.min(Math.max(0, scroll - headerheight ), Math.max(0,$(".related-datasheets").outerHeight() - datasheetheight));
     $(".tags-main, .main-datasheet").css({
-        "margin-top": Math.max(0, scroll - 60) + "px"
+        "margin-top": scrollval + "px"
     });
     var cvheight = Math.max($(".tags-main").outerHeight(), $(".related-datasheets").outerHeight()),
         cvwidth = $(".tag-container").width(),