Skip to content

Commit edc3eee

Browse files
committed
fix carousel event
1 parent 8e6697f commit edc3eee

File tree

5 files changed

+29
-17
lines changed

5 files changed

+29
-17
lines changed

docs/assets/js/bootstrap-carousel.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,18 @@
9494
, direction = type == 'next' ? 'left' : 'right'
9595
, fallback = type == 'next' ? 'first' : 'last'
9696
, that = this
97-
, e = $.Event('slide', {
98-
relatedTarget: $next[0]
99-
})
97+
, e
10098

10199
this.sliding = true
102100

103101
isCycling && this.pause()
104102

105103
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
106104

105+
e = $.Event('slide', {
106+
relatedTarget: $next[0]
107+
})
108+
107109
if ($next.hasClass('active')) return
108110

109111
if ($.support.transition && this.$element.hasClass('slide')) {
@@ -167,7 +169,7 @@
167169
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
168170
var $this = $(this), href
169171
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
170-
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
172+
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
171173
$target.carousel(options)
172174
e.preventDefault()
173175
})

docs/assets/js/bootstrap-tooltip.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@
235235
this.enabled = !this.enabled
236236
}
237237

238-
, toggle: function () {
239-
this[this.tip().hasClass('in') ? 'hide' : 'show']()
238+
, toggle: function (e) {
239+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
240+
self[self.tip().hasClass('in') ? 'hide' : 'show']()
240241
}
241242

242243
, destroy: function () {

docs/assets/js/bootstrap.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,16 +337,18 @@
337337
, direction = type == 'next' ? 'left' : 'right'
338338
, fallback = type == 'next' ? 'first' : 'last'
339339
, that = this
340-
, e = $.Event('slide', {
341-
relatedTarget: $next[0]
342-
})
340+
, e
343341

344342
this.sliding = true
345343

346344
isCycling && this.pause()
347345

348346
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
349347

348+
e = $.Event('slide', {
349+
relatedTarget: $next[0]
350+
})
351+
350352
if ($next.hasClass('active')) return
351353

352354
if ($.support.transition && this.$element.hasClass('slide')) {
@@ -410,7 +412,7 @@
410412
$('body').on('click.carousel.data-api', '[data-slide]', function ( e ) {
411413
var $this = $(this), href
412414
, $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7
413-
, options = !$target.data('modal') && $.extend({}, $target.data(), $this.data())
415+
, options = !$target.data('carousel') && $.extend({}, $target.data(), $this.data())
414416
$target.carousel(options)
415417
e.preventDefault()
416418
})
@@ -1193,8 +1195,9 @@
11931195
this.enabled = !this.enabled
11941196
}
11951197

1196-
, toggle: function () {
1197-
this[this.tip().hasClass('in') ? 'hide' : 'show']()
1198+
, toggle: function (e) {
1199+
var self = $(e.currentTarget)[this.type](this._options).data(this.type)
1200+
self[self.tip().hasClass('in') ? 'hide' : 'show']()
11981201
}
11991202

12001203
, destroy: function () {

docs/assets/js/bootstrap.min.js

Lines changed: 6 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/bootstrap-carousel.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,18 @@
9494
, direction = type == 'next' ? 'left' : 'right'
9595
, fallback = type == 'next' ? 'first' : 'last'
9696
, that = this
97-
, e = $.Event('slide', {
98-
relatedTarget: $next[0]
99-
})
97+
, e
10098

10199
this.sliding = true
102100

103101
isCycling && this.pause()
104102

105103
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
106104

105+
e = $.Event('slide', {
106+
relatedTarget: $next[0]
107+
})
108+
107109
if ($next.hasClass('active')) return
108110

109111
if ($.support.transition && this.$element.hasClass('slide')) {

0 commit comments

Comments
 (0)