]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add an update method to allow to update position for Tooltip/Popover/Dropdown manually
authorJohann-S <johann.servoire@gmail.com>
Wed, 19 Apr 2017 13:08:06 +0000 (15:08 +0200)
committerJohann-S <johann.servoire@gmail.com>
Sun, 14 May 2017 09:41:19 +0000 (11:41 +0200)
docs/components/dropdowns.md
docs/components/popovers.md
docs/components/tooltips.md
js/src/dropdown.js
js/src/tooltip.js

index 938447f3d6226e1471f47ebfd11f4a03de05af6d..7aa91773cfbf4ce88bf4862fb1d697310892ddbf 100644 (file)
@@ -568,6 +568,7 @@ Options can be passed via data attributes or JavaScript. For data attributes, ap
 | Method | Description |
 | --- | --- |
 | `$().dropdown('toggle')` | Toggles the dropdown menu of a given navbar or tabbed navigation. |
+| `$().dropdown('update')` | Updates the position of an element's dropdown. |
 
 ### Events
 
index 9366ac1a1dc21542a5db314bf53475534e699ccf..714bb0abcfde2bf401b84b25b06112c5841dda0a 100644 (file)
@@ -322,6 +322,12 @@ Toggles the ability for an element's popover to be shown or hidden.
 
 {% highlight js %}$('#element').popover('toggleEnabled'){% endhighlight %}
 
+#### `.popover('update')`
+
+Updates the position of an element's popover.
+
+{% highlight js %}$('#element').popover('update'){% endhighlight %}
+
 ### Events
 
 <table class="table table-bordered table-striped table-responsive">
index 54f3c448f58a3f55af19c5dfad7a62614c6bedba..6d6d2a26a02d58590cebf6ebf1f2fd7b99f1a46e 100644 (file)
@@ -298,6 +298,12 @@ Toggles the ability for an element's tooltip to be shown or hidden.
 
 {% highlight js %}$('#element').tooltip('toggleEnabled'){% endhighlight %}
 
+#### `.tooltip('update')`
+
+Updates the position of an element's tooltip.
+
+{% highlight js %}$('#element').tooltip('update'){% endhighlight %}
+
 ### Events
 
 <table class="table table-bordered table-striped table-responsive">
index 613a2381283618e08568a376927ce7aaff443141..0c082edd60bf3ef633784127725a18ff3eb4b6b0 100644 (file)
@@ -185,8 +185,14 @@ const Dropdown = (($) => {
       if (this._popper !== null) {
         this._popper.destroy()
       }
+      this._popper = null
     }
 
+    update() {
+      if (this._popper !== null) {
+        this._popper.scheduleUpdate()
+      }
+    }
 
     // private
 
index a8c0ab6f1dca6efa17846e7096ff2ba8dbc14819..d50ddbb3e89b8eb461028452ded17bc495054b16 100644 (file)
@@ -227,6 +227,9 @@ const Tooltip = (($) => {
       this._timeout       = null
       this._hoverState    = null
       this._activeTrigger = null
+      if (this._popper !== null) {
+        this._popper.destroy()
+      }
       this._popper        = null
 
       this.element = null
@@ -385,6 +388,11 @@ const Tooltip = (($) => {
 
     }
 
+    update() {
+      if (this._popper !== null) {
+        this._popper.scheduleUpdate()
+      }
+    }
 
     // protected
 
@@ -646,8 +654,8 @@ const Tooltip = (($) => {
     }
 
     _handlePopperPlacementChange(data) {
-        this._cleanTipClass()
-        this.addAttachmentClass(this._getAttachment(data.placement))
+      this._cleanTipClass()
+      this.addAttachmentClass(this._getAttachment(data.placement))
     }
 
     // static