mirror of
https://github.com/twbs/bootstrap.git
synced 2025-02-26 23:54:23 +01:00
Update toast.js & toasts.md
This commit is contained in:
parent
b22bc14ccb
commit
77a585b664
@ -199,7 +199,24 @@ class Toast extends BaseComponent {
|
||||
this._timeout = null
|
||||
}
|
||||
|
||||
_toggleProgressBar(time) {
|
||||
const progressBarElement = SelectorEngine.findOne(CLASS_PROGRESS_BAR, this._element)
|
||||
if (!progressBarElement) {
|
||||
return
|
||||
}
|
||||
|
||||
if (time) {
|
||||
progressBarElement.classList.add('animated')
|
||||
progressBarElement.style.animationDuration = `${time}ms`
|
||||
return
|
||||
}
|
||||
|
||||
progressBarElement.classList.remove('animated')
|
||||
reflow(progressBarElement)
|
||||
}
|
||||
|
||||
// Static
|
||||
|
||||
static jQueryInterface(config) {
|
||||
return this.each(function () {
|
||||
const data = Toast.getOrCreateInstance(this, config)
|
||||
@ -213,23 +230,6 @@ class Toast extends BaseComponent {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
_toggleProgressBar(time) {
|
||||
const progressBarElement = SelectorEngine.findOne(CLASS_PROGRESS_BAR, this._element)
|
||||
if (!progressBarElement) {
|
||||
return
|
||||
}
|
||||
|
||||
if (time) {
|
||||
progressBarElement.classList.add('animated')
|
||||
progressBarElement.style.animationDuration = `${time}ms`
|
||||
// reflow(progressBarElement)
|
||||
return
|
||||
}
|
||||
|
||||
progressBarElement.classList.remove('animated')
|
||||
reflow(progressBarElement)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +60,7 @@ Click the button below to show a toast (positioned with our utilities in the low
|
||||
<div class="toast-body">
|
||||
Hello, world! This is a toast message.
|
||||
</div>
|
||||
<div class="toast-progress"></div>
|
||||
<div class="toast-progress"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user