]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
addresses issues with transformations not being removed from orbit slides on touchend...
authorMark Hayes <mark@zurb.com>
Wed, 5 Mar 2014 22:29:00 +0000 (14:29 -0800)
committerMark Hayes <mark@zurb.com>
Wed, 5 Mar 2014 22:29:00 +0000 (14:29 -0800)
js/foundation/foundation.orbit.js

index d83a3add728c98a503103dfabb41991e82c554b4..fe8d79d4ec838b069375e80a9569cdaa7da0d282 100644 (file)
       
       var callback = function() {
         var unlock = function() {
-          self.cache.animating = false;
           if (start_timer === true) {self.cache.timer.restart();}
           self.update_slide_number(idx);
           next.addClass(settings.active_slide_class);
           self.update_active_link(next_idx);
           slides_container.trigger('after-slide-change.fndtn.orbit',[{slide_number: idx, total_slides: slides.length}]);
           settings.after_slide_change(idx, slides.length);
+          setTimeout(function(){
+            self.cache.animating = false;
+          }, 100);
+          
         };
         if (slides_container.height() != next.height() && settings.variable_height) {
           slides_container.animate({'height': next.height()}, 250, 'linear', unlock);
       var link = $(this).attr('data-orbit-link');
       if ((typeof link === 'string') && (link = $.trim(link)) != "") {
         var slide = container.find('[data-orbit-slide='+link+']');
-        if (slide.index() != -1) {self._goto(slide.index());}
+        if (slide.index() != -1) {
+          setTimeout(function(){
+            self._goto(slide.index());
+          },100);
+        }
       }
     };
 
         if(isNaN(parseInt(index)))
         {
           var slide = container.find('[data-orbit-slide='+index+']');
-          if (slide.index() != -1) {self._goto(slide.index() + 1);}
+          if (slide.index() != -1) {
+            setTimeout(function(){
+              self._goto(slide.index() + 1);
+            },100);
+          }
         }
         else
         {
-          self._goto(parseInt(index));
+          setTimeout(function(){
+            self._goto(parseInt(index));
+          },100);
         }
       }
 
       container.on('click', self.toggle_timer);
       if (settings.swipe) {
         slides_container.on('touchstart.fndtn.orbit',function(e) {
-          if (self.cache.animating) {return;}
           e.preventDefault();
           e.stopPropagation();
+          if (self.cache.animating) {return;}
           if (!e.touches) {e = e.originalEvent;}
-          
-          slides_container.children().css({
-            "transform": "",
-            "transitionDuration": ""
-          });
 
           self.cache.start_page_x = e.touches[0].pageX;
           self.cache.start_page_y = e.touches[0].pageY;
         })
         .on('touchmove.fndtn.orbit',function(e) {
           if (self.cache.animating) {return;}
-          // console.info('touchmove');
+
           e.preventDefault();
           e.stopPropagation();
           requestAnimationFrame(function(){
 
             var offset, next_offset;
             
-
             offset = (self.cache.delta_x / container.width()) * 100;
             if (offset >= 0) {next_offset = -(100 - offset);}
             else {next_offset = 100 + offset;}
           if (self.cache.animating) {return;}
           e.preventDefault();
           e.stopPropagation();
-          self._goto(self.cache.direction);
-        })
+          setTimeout(function(){
+            self._goto(self.cache.direction);
+          }, 50);
+        });
       }
       container.on('mouseenter.fndtn.orbit', function(e) {
         if (settings.timer && settings.pause_on_hover) {