0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

Run grunt.

This commit is contained in:
XhmikosR 2014-08-01 19:49:54 +03:00
parent 1625102671
commit de1d8c36ad
7 changed files with 27 additions and 13 deletions

11
dist/js/bootstrap.js vendored
View File

@ -339,6 +339,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
return this.$items.index(item || this.$active) return this.$items.index(item || this.$active)
} }
Carousel.prototype.getItemForDirection = function (direction, active) {
var delta = direction == 'prev' ? -1 : 1
var activeIndex = this.getItemIndex(active)
var itemIndex = (activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to = function (pos) { Carousel.prototype.to = function (pos) {
var that = this var that = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
@ -348,7 +355,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
if (activeIndex == pos) return this.pause().cycle() if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
} }
Carousel.prototype.pause = function (e) { Carousel.prototype.pause = function (e) {
@ -376,7 +383,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
Carousel.prototype.slide = function (type, next) { Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active') var $active = this.$element.find('.item.active')
var $next = next || $active[type]() var $next = next || this.getItemForDirection(type, $active)
var isCycling = this.interval var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right' var direction = type == 'next' ? 'left' : 'right'
var fallback = type == 'next' ? 'first' : 'last' var fallback = type == 'next' ? 'first' : 'last'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -339,6 +339,13 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
return this.$items.index(item || this.$active) return this.$items.index(item || this.$active)
} }
Carousel.prototype.getItemForDirection = function (direction, active) {
var delta = direction == 'prev' ? -1 : 1
var activeIndex = this.getItemIndex(active)
var itemIndex = (activeIndex + delta) % this.$items.length
return this.$items.eq(itemIndex)
}
Carousel.prototype.to = function (pos) { Carousel.prototype.to = function (pos) {
var that = this var that = this
var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active')) var activeIndex = this.getItemIndex(this.$active = this.$element.find('.item.active'))
@ -348,7 +355,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid" if (this.sliding) return this.$element.one('slid.bs.carousel', function () { that.to(pos) }) // yes, "slid"
if (activeIndex == pos) return this.pause().cycle() if (activeIndex == pos) return this.pause().cycle()
return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) return this.slide(pos > activeIndex ? 'next' : 'prev', this.$items.eq(pos))
} }
Carousel.prototype.pause = function (e) { Carousel.prototype.pause = function (e) {
@ -376,7 +383,7 @@ if (typeof jQuery === 'undefined') { throw new Error('Bootstrap\'s JavaScript re
Carousel.prototype.slide = function (type, next) { Carousel.prototype.slide = function (type, next) {
var $active = this.$element.find('.item.active') var $active = this.$element.find('.item.active')
var $next = next || $active[type]() var $next = next || this.getItemForDirection(type, $active)
var isCycling = this.interval var isCycling = this.interval
var direction = type == 'next' ? 'left' : 'right' var direction = type == 'next' ? 'left' : 'right'
var fallback = type == 'next' ? 'first' : 'last' var fallback = type == 'next' ? 'first' : 'last'

File diff suppressed because one or more lines are too long