]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Fix bad position for Tooltips with animation at true
authorJohann-S <johann.servoire@gmail.com>
Fri, 12 May 2017 07:39:27 +0000 (09:39 +0200)
committerJohann-S <johann.servoire@gmail.com>
Sun, 14 May 2017 09:41:19 +0000 (11:41 +0200)
js/src/tooltip.js

index eb517252e0f95dc4920005779b7e819d993a2378..6d3db06ab9b6d6e674b125ac72a8ad6cac00b414 100644 (file)
@@ -306,8 +306,6 @@ const Tooltip = (($) => {
           }
         })
 
-        Util.reflow(tip)
-
         $(tip).addClass(ClassName.SHOW)
 
         // if this is a touch-enabled device we add extra
@@ -319,6 +317,9 @@ const Tooltip = (($) => {
         }
 
         const complete = () => {
+          if (this.config.animation) {
+            this._fixTransition()
+          }
           const prevHoverState = this._hoverState
           this._hoverState     = null
 
@@ -333,10 +334,10 @@ const Tooltip = (($) => {
           $(this.tip)
             .one(Util.TRANSITION_END, complete)
             .emulateTransitionEnd(Tooltip._TRANSITION_DURATION)
-          return
         }
-
-        complete()
+        else {
+          complete()
+        }
       }
     }
 
@@ -663,6 +664,19 @@ const Tooltip = (($) => {
       this.addAttachmentClass(this._getAttachment(data.placement))
     }
 
+    _fixTransition() {
+      const tip                 = this.getTipElement()
+      const initConfigAnimation = this.config.animation
+      if (tip.getAttribute('x-placement') !== null) {
+        return;
+      }
+      $(tip).removeClass(ClassName.FADE)
+      this.config.animation = false
+      this.hide()
+      this.show()
+      this.config.animation = initConfigAnimation
+    }
+
     // static
 
     static _jQueryInterface(config) {