1/* 2 * Copyright 2012-2018, 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 // Check for RTL layout. 10 var isRtl = me.options['isRtl']; 11 var transitionDirection = isRtl ? 'right' : 'left'; 12 13 // Init 14 var width = me.slideContainer.innerWidth(); 15 var diff = newIndex - previousIndex; 16 var direction = diff > 0 ? 1 : -1; 17 18 // Start all animations at once, at the end of this function. Otherwise we can get rare race conditions. 19 var animationsQueue = []; 20 21 // Remove previous slide. 22 var previousSlide = previousIndex !== null ? $(me.slides[previousIndex].content) : null; 23 if (previousSlide) { 24 me.slideContainer.css('height', previousSlide.innerHeight()); 25 animationsQueue.push(function () { 26 var animateOptions = {}; 27 animateOptions[transitionDirection] = -direction * width; 28 29 previousSlide 30 .css('width', width) 31 .css('position', 'absolute') 32 .css(transitionDirection, 0) 33 .animate(animateOptions, me.options.transitionSpeed, function (me, previousIndex) { 34 return function () { 35 $(this) 36 .detach() 37 .css('position', '') 38 .css(transitionDirection, ''); 39 me.decrementSemaphore(); 40 } 41 }(me, previousIndex)); 42 }); 43 } 44 45 var slide = me.slides[newIndex].content; 46 47 if (previousSlide == null) { 48 // Don't animate the first shown slide. 49 me.slideContainer.append(slide); 50 } 51 else { 52 slide.css('width', width); 53 slide.css('visibility', 'hidden'); 54 me.slideContainer.append(slide); 55 56 // Call event handlers. 57 me.onNewSlide(); 58 59 // Animate the height. 60 animationsQueue.push(function () { 61 me.slideContainer.animate({ 62 'height': slide.innerHeight() 63 }, me.options.transitionSpeed, function (me) { 64 return function () { 65 $(this) 66 .css('position', ''); 67 me.decrementSemaphore(); 68 } 69 }(me)); 70 }); 71 72 // Animate the new slide. 73 animationsQueue.push(function () { 74 var animateOptions = {}; 75 animateOptions[transitionDirection] = '0'; 76 77 slide 78 .css(transitionDirection, direction * width) 79 .css('position', 'absolute') 80 .css('visibility', 'visible') 81 .animate( 82 animateOptions, me.options.transitionSpeed, function (me) { 83 return function () { 84 $(this) 85 .css('position', '') 86 .css('width', ''); 87 me.slideContainer.css('height', ''); 88 me.decrementSemaphore(); 89 } 90 }(me)); 91 }); 92 } 93 94 return animationsQueue; 95};
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.