diff options
Diffstat (limited to 'dist/js/umd/carousel.js')
| -rw-r--r-- | dist/js/umd/carousel.js | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/dist/js/umd/carousel.js b/dist/js/umd/carousel.js index 1163ca2c1..9a03d3776 100644 --- a/dist/js/umd/carousel.js +++ b/dist/js/umd/carousel.js @@ -194,7 +194,7 @@ return; } - if (activeIndex == index) { + if (activeIndex === index) { this.pause(); this.cycle(); return; @@ -236,7 +236,7 @@ $(this._element).on(Event.KEYDOWN, $.proxy(this._keydown, this)); } - if (this._config.pause == 'hover' && !('ontouchstart' in document.documentElement)) { + if (this._config.pause === 'hover' && !('ontouchstart' in document.documentElement)) { $(this._element).on(Event.MOUSEENTER, $.proxy(this.pause, this)).on(Event.MOUSELEAVE, $.proxy(this.cycle, this)); } } @@ -245,7 +245,9 @@ value: function _keydown(event) { event.preventDefault(); - if (/input|textarea/i.test(event.target.tagName)) return; + if (/input|textarea/i.test(event.target.tagName)) { + return; + } switch (event.which) { case 37: @@ -269,13 +271,13 @@ var isPrevDirection = direction === Direction.PREVIOUS; var activeIndex = this._getItemIndex(activeElement); var lastItemIndex = this._items.length - 1; - var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex == lastItemIndex; + var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; if (isGoingToWrap && !this._config.wrap) { return activeElement; } - var delta = direction == Direction.PREVIOUS ? -1 : 1; + var delta = direction === Direction.PREVIOUS ? -1 : 1; var itemIndex = (activeIndex + delta) % this._items.length; return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; @@ -313,9 +315,9 @@ var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0]; var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); - var isCycling = !!this._interval; + var isCycling = Boolean(this._interval); - var directionalClassName = direction == Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT; + var directionalClassName = direction === Direction.NEXT ? ClassName.LEFT : ClassName.RIGHT; if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) { this._isSliding = false; @@ -400,7 +402,7 @@ $(this).data(DATA_KEY, data); } - if (typeof config == 'number') { + if (typeof config === 'number') { data.to(config); } else if (action) { data[action](); @@ -426,8 +428,8 @@ } var config = $.extend({}, $(target).data(), $(this).data()); - var slideIndex = this.getAttribute('data-slide-to'); + if (slideIndex) { config.interval = false; } |
