Zatrzymaj karuzelę Bootstrap na Twitterze na końcu swoich slajdów
Karuzela Bootstrap to dziwna bestia. Próbowałem ulepszyć $ obok, aby zapobiec nieskończonemu zapętleniu, ale skończyć albo zerwaniem, albo uniemożliwieniem przesuwania slajdów po osiągnięciu końca.
Chciałbym, aby karuzela przesuwała się tylko na liście i nie zapętlała się w nieskończoność.
Każda pomoc byłaby doceniana.
$next = $next.length ? $next : this.$element.find('.item')[fallback]()
if ($next.hasClass('active')) return
if ($.support.transition && this.$element.hasClass('slide')) {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$next.addClass(type)
$next[0].offsetWidth // force reflow
$active.addClass(direction)
$next.addClass(direction)
this.$element.one($.support.transition.end, function() {
$next.removeClass([type, direction].join(' ')).addClass('active')
$active.removeClass(['active', direction].join(' '))
that.sliding = false
setTimeout(function() {
that.$element.trigger('slid')
}, 0)
})
} else {
this.$element.trigger(e)
if (e.isDefaultPrevented()) return
$active.removeClass('active')
$next.addClass('active')
this.sliding = false
this.$element.trigger('slid')
}
Aktualizacja: To nie ma związku z „autoodtwarzaniem”, a konkretnie mam na myśli ręczne naciśnięcie lewego i prawego przycisku.