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

Commit

Permalink
fix(carousel): correct reflow triggering on FFox and Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
mysza authored and pkozlowski-opensource committed Aug 15, 2013
1 parent d3da8b7 commit d34f2de
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/carousel/carousel.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @ngdoc overview
* @name ui.bootstrap.carousel
*
*
* @description
* AngularJS version of an image carousel.
*
Expand Down Expand Up @@ -32,10 +32,10 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])
}
function goNext() {
//If we have a slide to transition from and we have a transition type and we're allowed, go
if (self.currentSlide && angular.isString(direction) && !$scope.noTransition && nextSlide.$element) {
if (self.currentSlide && angular.isString(direction) && !$scope.noTransition && nextSlide.$element) {
//We shouldn't do class manip in here, but it's the same weird thing bootstrap does. need to fix sometime
nextSlide.$element.addClass(direction);
nextSlide.$element[0].offsetWidth = nextSlide.$element[0].offsetWidth; //force reflow
var reflow = nextSlide.$element[0].offsetWidth; //force reflow

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

$scope.next = function() {
var newIndex = (currentIndex + 1) % slides.length;

//Prevent this user-triggered transition from occurring if there is already one in progress
if (!$scope.$currentTransition) {
return self.select(slides[newIndex], 'next');
Expand All @@ -83,7 +83,7 @@ angular.module('ui.bootstrap.carousel', ['ui.bootstrap.transition'])

$scope.prev = function() {
var newIndex = currentIndex - 1 < 0 ? slides.length - 1 : currentIndex - 1;

//Prevent this user-triggered transition from occurring if there is already one in progress
if (!$scope.$currentTransition) {
return self.select(slides[newIndex], 'prev');
Expand Down Expand Up @@ -300,7 +300,7 @@ function CarouselDemoCtrl($scope) {
var lastValue = scope.active = getActive(scope.$parent);
scope.$watch(function parentActiveWatch() {
var parentActive = getActive(scope.$parent);

if (parentActive !== scope.active) {
// we are out of sync and need to copy
if (parentActive !== lastValue) {
Expand Down

0 comments on commit d34f2de

Please sign in to comment.