ux/FlipCounter.js
[roojs1] / ux / FlipCounter.js
index e003828..39a0196 100644 (file)
@@ -72,7 +72,7 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
         var digit = new Roo.ux.FlipCounter.Digit({ manager : this, currentNumber : num });
         digit.manager = this;
         this.digits.push(digit);
-        digit.render(this.el);
+        digit.render(this.el, 0);
          
         // Update width
         this.ulWidth = this.ulWidth + digit.el.getWidth(true);
@@ -87,8 +87,8 @@ Roo.extend(Roo.ux.FlipCounter, Roo.bootstrap.Component, {
     {
         var digit = this.digits.splice(this.digits.length-1, 1)[0];
         
-        this.ulWidth = this.ulWidth - digit.el.outerWidth(true);
-        digit.li.remove();
+        this.ulWidth = this.ulWidth - digit.el.getWidth(true);
+        digit.el.remove();
         
         // Remove separators
         if (this.digits.length % 3 == 0)
@@ -160,6 +160,10 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
 
     manager : null, // the flipcounter... 
     currentNumber : 0,
+    
+    
+    currentNum : 0,
+    nextNum : 0,
     targetNum : 0,
     
     topFrontDiv  : null,
@@ -170,6 +174,8 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
     bottomNumFront : null,
     
     
+    
+    
     getAutoCreate : function(){
         
         return {
@@ -224,16 +230,16 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
         
          
         
-        this.topFrontDiv = this.el.select('.flipper_top_front',true);
-        this.bottomFrontDiv = this.el.select('.flipper_bottom_front',true);
-        this.topNumBack = this.el.select('.flipper_top_back span',true);
-        this.topNumFront = this.el.select('.flipper_top_front span',true);
-        this.bottomNumBack = this.el.select('.flipper_bottom_back span',true);
-        this.bottomNumFront = this.el.select('.flipper_bottom_front span',true);
+        this.topFrontDiv = this.el.select('.flipper_top_front',true).first();
+        this.bottomFrontDiv = this.el.select('.flipper_bottom_front',true).first();
+        this.topNumBack = this.el.select('.flipper_top_back span',true).first();
+        this.topNumFront = this.el.select('.flipper_top_front span',true).first();
+        this.bottomNumBack = this.el.select('.flipper_bottom_back span',true).first();
+        this.bottomNumFront = this.el.select('.flipper_bottom_front span',true).first();
         
-        this.targetNum = currentNumber;
-        this.currentNum = currentNumber;
-        this.nextNum = currentNumber;
+        this.targetNum = this.currentNumber;
+        this.currentNum = this.currentNumber;
+        this.nextNum = this.currentNumber;
         
         this.currentlyAnimating = false;
     },
@@ -273,7 +279,7 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
         
         // Animate top flipper
         var digit = this;
-        digit.topNumBack.html(digit.nextNum);
+        digit.topNumBack.dom.innerHTML = digit.nextNum;
         (function() {
             digit.topFrontDiv.animate(
                 {
@@ -295,7 +301,7 @@ Roo.extend(Roo.ux.FlipCounter.Digit, Roo.bootstrap.Component, {
                     scaleY: {from: 0, to : 1},
                     
                 },
-                this.manager.options.speed * 0.5, //duration
+                this.manager.speed * 0.5, //duration
                 function() {
                     digit.currentNum = digit.nextNum;
                     digit.topNumFront.dom.innerHTML = digit.currentNum;