1/* 2 * Copyright 2012-2015, Theia Post Slider, WeCodePixels, http://wecodepixels.com 3 */ 4var tps = tps || {}; 5tps.transitions = tps.transitions || {}; 6tps.transitions.slide = function (me, previousIndex, newIndex) { 7 var $ = jQuery; 8 9 // Init 10 var width = me.slideContainer.innerWidth(); 11 var diff = newIndex - previousIndex; 12 var direction = diff > 0 ? 1 : -1; 13 14 // Start all animations at once, at the end of this function. Otherwise we can get rare race conditions. 15 var animationsQueue = []; 16 17 // Remove previous slide. 18 var previousSlide = previousIndex !== null ? $(me.slides[previousIndex].content) : null; 19 if (previousSlide) { 20 me.slideContainer.css('height', previousSlide.innerHeight()); 21 animationsQueue.push(function () { 22 previousSlide 23 .css('width', width) 24 .css('position', 'absolute') 25 .css('left', 0) 26 .animate({ 27 left: -direction * width 28 }, me.options.transitionSpeed, function (me, previousIndex) { 29 return function () { 30 $(this) 31 .detach() 32 .css('position', '') 33 .css('left', ''); 34 me.decrementSemaphore(); 35 } 36 }(me, previousIndex)); 37 }); 38 } 39 40 var slide = me.slides[newIndex].content; 41 42 if (previousSlide == null) { 43 // Don't animate the first shown slide. 44 me.slideContainer.append(slide); 45 } 46 else { 47 slide.css('width', width); 48 slide.css('visibility', 'hidden'); 49 me.slideContainer.append(slide); 50 51 // Call event handlers. 52 me.onNewSlide(); 53 54 // Animate the height. 55 animationsQueue.push(function () { 56 me.slideContainer.animate({ 57 'height': slide.innerHeight() 58 }, me.options.transitionSpeed, function (me) { 59 return function () { 60 $(this) 61 .css('position', ''); 62 me.decrementSemaphore(); 63 } 64 }(me)); 65 }); 66 67 // Animate the new slide. 68 animationsQueue.push(function () { 69 slide 70 .css('left', direction * width) 71 .css('position', 'absolute') 72 .css('visibility', 'visible') 73 .animate({ 74 left: '0' 75 }, me.options.transitionSpeed, function (me) { 76 return function () { 77 $(this) 78 .css('position', '') 79 .css('width', ''); 80 me.slideContainer.css('height', ''); 81 me.decrementSemaphore(); 82 } 83 }(me)); 84 }); 85 } 86 87 return animationsQueue; 88};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.