فهرست منبع

Fixed sticky tooltip bug

Unknown 7 سال پیش
والد
کامیت
88f7f9237a
1فایلهای تغییر یافته به همراه13 افزوده شده و 3 حذف شده
  1. 13 3
      canvas/js/canvas.js

+ 13 - 3
canvas/js/canvas.js

@@ -6,9 +6,6 @@ $(document).ready(function() {
     // Declare the currently loaded tags belonging to the user
     // Declare the currently loaded tags belonging to the user
     var tags;
     var tags;
     
     
-    // Show tooltip for every category
-    $("[data-toggle='tooltip']").tooltip({container: "body"});
-    
     // Fix to make the "X" in the Close button in dialogs show up
     // Fix to make the "X" in the Close button in dialogs show up
     $.fn.bootstrapBtn = $.fn.button.noConflict();    
     $.fn.bootstrapBtn = $.fn.button.noConflict();    
     
     
@@ -162,6 +159,7 @@ $(document).ready(function() {
         $(".jump-to img").toggleClass("jump-to-arrow-90");
         $(".jump-to img").toggleClass("jump-to-arrow-90");
         $(".jump-to img").toggleClass("jump-to-arrow-0");
         $(".jump-to img").toggleClass("jump-to-arrow-0");
         
         
+        // Detect the scroll position of the chosen field
         // If the user has chosen the list item 0
         // If the user has chosen the list item 0
         if(chosenLiIndex === 0) {
         if(chosenLiIndex === 0) {
             chosenFieldPosition = $("div.saved-tags").offset().top;
             chosenFieldPosition = $("div.saved-tags").offset().top;
@@ -175,6 +173,7 @@ $(document).ready(function() {
             chosenFieldPosition = $("div.field_" + chosenLiIndex).offset().top;
             chosenFieldPosition = $("div.field_" + chosenLiIndex).offset().top;
         }
         }
         
         
+        // Set the new scroll position
         // If the user has chosen to jump to "Saved Tags"
         // If the user has chosen to jump to "Saved Tags"
         if(chosenLiIndex === 0) {
         if(chosenLiIndex === 0) {
             scrollPositionNew = chosenFieldPosition - 14; // 14 // - $("div.jump-to").height() + 38;
             scrollPositionNew = chosenFieldPosition - 14; // 14 // - $("div.jump-to").height() + 38;
@@ -184,11 +183,22 @@ $(document).ready(function() {
             scrollPositionNew = chosenFieldPosition - 57; // 77 // - $("div.jump-to").height() - 20;
             scrollPositionNew = chosenFieldPosition - 57; // 77 // - $("div.jump-to").height() - 20;
         }
         }
         
         
+        // Apply the new scroll position
         $(window).scrollTop(scrollPositionNew);
         $(window).scrollTop(scrollPositionNew);
         
         
         return false;
         return false;
     });
     });
     
     
+    /* ================================================
+    Show tooltip for every category
+    ================================================= */
+    
+    $("a[data-toggle='tooltip']").tooltip({container: "body"});
+    
+    $("a[data-toggle='tooltip']").on("click", function() {
+        return false;
+    });
+    
     /* ================================================
     /* ================================================
     Remove all tags from all fields
     Remove all tags from all fields
     ================================================= */
     ================================================= */