I have this function:
var decreaseBar = function (barElement) {
   insertCSSTransitions(barElement);
   $(barElement).find('.bar').width(0);
}
The insertCSSTransitions(barElement) function, do this:
var insertCSSTransitions = function (barElement) {
      var timeBar = settings.timeBar;
      $(barElement).find('.bar').attr('style', 'transition:width ' + timeBar + 's; -moz-transition:width ' + timeBar + 's; -webkit-transition:width ' + timeBar + 's; -o-transition:width ' + timeBar + 's');
}
What happens is: the $(barElement).find('.bar').width(0); line set the width to 0 before the style of cssTransitions work.
Because, if I modify decreaseBar function to that, it works:
var decreaseBar = function (barElement) {
   insertCSSTransitions(barElement);
   // set a delay of 1 second before set to 0
   setTimeout(function() {
      $(barElement).find('.bar').width(0);
   }, 1000)
}
The code is not synchronized when manipulating the DOM with jQuery?
 
     
     
     
     
    