You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you clicked on the next (prev) element, the following callback is invoked:
$('body').on('click.carousel.data-api','[data-slide]',function(e){var$this=$(this),href,$target=$($this.attr('data-target')||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/,''))//strip for ie7,options=!$target.data('modal')&&$.extend({},$target.data(),$this.data())$target.carousel(options)e.preventDefault()})
But if the browser don't support transition, this is false.
Workaround
It seems like no need to cause the slide method in constructor, because later in the carousel prototype method the next or prev method will be called for sure.
You can try here: http://jsfiddle.net/vm9vX/6/
Explored
When you clicked on the next (prev) element, the following callback is invoked:
Then you'll go to the
carousel
prototype method:Because this
$this.data('carousel')
isundefined
you'll go to theCarousel
constructor:Because the
options
object has not emptyslide
property, corresponding method will be called.After successful sliding and other
Carousel
initialization you will come back tocarousel
prototype method.The sliding operation
action
was also defined here. After thisdata[action]()
invoke, theslide
method will be called amiss again.Next time there will no duplication, because the
$this.data('carousel')
has already been initialized and theCarousel
constructor will not be called.Why only in browsers which don't support transition
If the browser supports transition, at the
next
orprev
method calling,this.sliding
will betrue
.But if the browser don't support transition, this is
false
.Workaround
It seems like no need to cause the slide method in constructor, because later in the
carousel
prototype method thenext
orprev
method will be called for sure.The text was updated successfully, but these errors were encountered: