Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Commit d34f2de

Browse files
myszapkozlowski-opensource
authored andcommitted
fix(carousel): correct reflow triggering on FFox and Safari
1 parent d3da8b7 commit d34f2de

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/carousel/carousel.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @ngdoc overview
33
* @name ui.bootstrap.carousel
4-
*
4+
*
55
* @description
66
* AngularJS version of an image carousel.
77
*
@@ -32,10 +32,10 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
3232
}
3333
function goNext() {
3434
//If we have a slide to transition from and we have a transition type and we're allowed, go
35-
if (self.currentSlide && angular.isString(direction) && !$scope.noTransition && nextSlide.$element) {
35+
if (self.currentSlide && angular.isString(direction) && !$scope.noTransition && nextSlide.$element) {
3636
//We shouldn't do class manip in here, but it's the same weird thing bootstrap does. need to fix sometime
3737
nextSlide.$element.addClass(direction);
38-
nextSlide.$element[0].offsetWidth = nextSlide.$element[0].offsetWidth; //force reflow
38+
var reflow = nextSlide.$element[0].offsetWidth; //force reflow
3939

4040
//Set all other slides to stop doing their stuff for the new transition
4141
angular.forEach(slides, function(slide) {
@@ -74,7 +74,7 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
7474

7575
$scope.next = function() {
7676
var newIndex = (currentIndex + 1) % slides.length;
77-
77+
7878
//Prevent this user-triggered transition from occurring if there is already one in progress
7979
if (!$scope.$currentTransition) {
8080
return self.select(slides[newIndex], 'next');
@@ -83,7 +83,7 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
8383

8484
$scope.prev = function() {
8585
var newIndex = currentIndex - 1 < 0 ? slides.length - 1 : currentIndex - 1;
86-
86+
8787
//Prevent this user-triggered transition from occurring if there is already one in progress
8888
if (!$scope.$currentTransition) {
8989
return self.select(slides[newIndex], 'prev');
@@ -300,7 +300,7 @@ function CarouselDemoCtrl($scope) {
300300
var lastValue = scope.active = getActive(scope.$parent);
301301
scope.$watch(function parentActiveWatch() {
302302
var parentActive = getActive(scope.$parent);
303-
303+
304304
if (parentActive !== scope.active) {
305305
// we are out of sync and need to copy
306306
if (parentActive !== lastValue) {

0 commit comments

Comments
 (0)