1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-10-03 08:41:59 +02:00

Cache a few variables.

This commit is contained in:
XhmikosR
2020-07-08 20:09:39 +03:00
parent c86b74fe88
commit b31046aab3
4 changed files with 12 additions and 9 deletions

View File

@@ -129,10 +129,11 @@ class Carousel {
}
nextWhenVisible() {
const $element = $(this._element)
// Don't call next when the page isn't visible
// or the carousel or its parent isn't visible
if (!document.hidden &&
($(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden')) {
($element.is(':visible') && $element.css('visibility') !== 'hidden')) {
this.next()
}
}