diff options
author | Gleb Mazovetskiy <glex.spb@gmail.com> | 2014-11-18 00:35:24 +0300 |
---|---|---|
committer | Gleb Mazovetskiy <glebm@google.com> | 2015-01-18 01:49:14 +0300 |
commit | 386bf387ccabd3aec63745ec58fb828c5cd28f80 (patch) | |
tree | 58b92068a54b9bbca60aa09f95933fc21ed003bc /assets | |
parent | 847887b0ac523221b80cb986e5e42241bab0158a (diff) |
rake convert
Diffstat (limited to 'assets')
-rw-r--r-- | assets/javascripts/bootstrap.js | 13 | ||||
-rw-r--r-- | assets/javascripts/bootstrap/carousel.js | 11 | ||||
-rw-r--r-- | assets/javascripts/bootstrap/collapse.js | 2 | ||||
-rw-r--r-- | assets/stylesheets/bootstrap/_carousel.scss | 12 |
4 files changed, 16 insertions, 22 deletions
diff --git a/assets/javascripts/bootstrap.js b/assets/javascripts/bootstrap.js index b6ac8d99..50a4c3cc 100644 --- a/assets/javascripts/bootstrap.js +++ b/assets/javascripts/bootstrap.js @@ -359,8 +359,11 @@ if (typeof jQuery === 'undefined') { } Carousel.prototype.getItemForDirection = function (direction, active) { - var delta = direction == 'prev' ? -1 : 1 var activeIndex = this.getItemIndex(active) + var willWrap = (direction == 'prev' && activeIndex === 0) + || (direction == 'next' && activeIndex == (this.$items.length - 1)) + if (willWrap && !this.options.wrap) return active + var delta = direction == 'prev' ? -1 : 1 var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } @@ -405,14 +408,8 @@ if (typeof jQuery === 'undefined') { var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' - var fallback = type == 'next' ? 'first' : 'last' var that = this - if (!$next.length) { - if (!this.options.wrap) return - $next = this.$element.find('.item')[fallback]() - } - if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] @@ -576,7 +573,7 @@ if (typeof jQuery === 'undefined') { if (this.transitioning || this.$element.hasClass('in')) return var activesData - var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing') + var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') if (actives && actives.length) { activesData = actives.data('bs.collapse') diff --git a/assets/javascripts/bootstrap/carousel.js b/assets/javascripts/bootstrap/carousel.js index 282d618f..99a077c1 100644 --- a/assets/javascripts/bootstrap/carousel.js +++ b/assets/javascripts/bootstrap/carousel.js @@ -70,8 +70,11 @@ } Carousel.prototype.getItemForDirection = function (direction, active) { - var delta = direction == 'prev' ? -1 : 1 var activeIndex = this.getItemIndex(active) + var willWrap = (direction == 'prev' && activeIndex === 0) + || (direction == 'next' && activeIndex == (this.$items.length - 1)) + if (willWrap && !this.options.wrap) return active + var delta = direction == 'prev' ? -1 : 1 var itemIndex = (activeIndex + delta) % this.$items.length return this.$items.eq(itemIndex) } @@ -116,14 +119,8 @@ var $next = next || this.getItemForDirection(type, $active) var isCycling = this.interval var direction = type == 'next' ? 'left' : 'right' - var fallback = type == 'next' ? 'first' : 'last' var that = this - if (!$next.length) { - if (!this.options.wrap) return - $next = this.$element.find('.item')[fallback]() - } - if ($next.hasClass('active')) return (this.sliding = false) var relatedTarget = $next[0] diff --git a/assets/javascripts/bootstrap/collapse.js b/assets/javascripts/bootstrap/collapse.js index b2cc1253..a2ede591 100644 --- a/assets/javascripts/bootstrap/collapse.js +++ b/assets/javascripts/bootstrap/collapse.js @@ -46,7 +46,7 @@ if (this.transitioning || this.$element.hasClass('in')) return var activesData - var actives = this.$parent && this.$parent.find('> .panel').children('.in, .collapsing') + var actives = this.$parent && this.$parent.children('.panel').children('.in, .collapsing') if (actives && actives.length) { activesData = actives.data('bs.collapse') diff --git a/assets/stylesheets/bootstrap/_carousel.scss b/assets/stylesheets/bootstrap/_carousel.scss index 49db83fc..3a9853bc 100644 --- a/assets/stylesheets/bootstrap/_carousel.scss +++ b/assets/stylesheets/bootstrap/_carousel.scss @@ -27,24 +27,24 @@ // WebKit CSS3 transforms for supported devices @media all and (transform-3d), (-webkit-transform-3d) { - transition: transform .6s ease-in-out; - backface-visibility: hidden; - perspective: 1000; + @include transition-transform(~'0.6s ease-in-out'); + @include backface-visibility(~'hidden'); + @include perspective(1000); &.next, &.active.right { - transform: translate3d(100%, 0, 0); + @include translate3d(100%, 0, 0); left: 0; } &.prev, &.active.left { - transform: translate3d(-100%, 0, 0); + @include translate3d(-100%, 0, 0); left: 0; } &.next.left, &.prev.right, &.active { - transform: translate3d(0, 0, 0); + @include translate3d(0, 0, 0); left: 0; } } |