aboutsummaryrefslogtreecommitdiff
path: root/js/src/carousel.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/carousel.js')
-rw-r--r--js/src/carousel.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/js/src/carousel.js b/js/src/carousel.js
index 5993de256..3a6d7a4bc 100644
--- a/js/src/carousel.js
+++ b/js/src/carousel.js
@@ -1,14 +1,15 @@
+import $ from 'jquery'
import Util from './util'
/**
* --------------------------------------------------------------------------
- * Bootstrap (v4.0.0-alpha.6): carousel.js
+ * Bootstrap (v4.0.0-beta): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
* --------------------------------------------------------------------------
*/
-const Carousel = (($) => {
+const Carousel = (() => {
/**
@@ -18,7 +19,7 @@ const Carousel = (($) => {
*/
const NAME = 'carousel'
- const VERSION = '4.0.0-alpha.6'
+ const VERSION = '4.0.0-beta'
const DATA_KEY = 'bs.carousel'
const EVENT_KEY = `.${DATA_KEY}`
const DATA_API_KEY = '.data-api'
@@ -131,7 +132,9 @@ const Carousel = (($) => {
nextWhenVisible() {
// Don't call next when the page isn't visible
- if (!document.hidden) {
+ // or the carousel or its parent isn't visible
+ if (!document.hidden &&
+ ($(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden')) {
this.next()
}
}
@@ -441,7 +444,7 @@ const Carousel = (($) => {
if (typeof config === 'number') {
data.to(config)
} else if (typeof action === 'string') {
- if (data[action] === undefined) {
+ if (typeof data[action] === 'undefined') {
throw new Error(`No method named "${action}"`)
}
data[action]()
@@ -516,6 +519,6 @@ const Carousel = (($) => {
return Carousel
-})(jQuery)
+})($)
export default Carousel