1// ------------------------------------------------------------------------------------------- 2// Avia Timeline 3// ------------------------------------------------------------------------------------------- 4 5 6(function($) { 7 "use strict"; 8 9 $(window).on('load', function (e) { 10 if ($.AviaSlider) { 11 $('.avia-timeline-container').avia_sc_timeline(); 12 } 13 }); 14 15 16 $.fn.avia_sc_timeline = function (options) { 17 18 return this.each(function () { 19 20 var container = this, 21 timeline_id = '#' + $(this).attr('id'), 22 timeline = $(timeline_id), 23 methods; 24 25 methods = 26 { 27 // make sure all milestones have the same height in horizontal timelines 28 matchHeights: function(){ 29 30 //date 31 this.setMinHeight( $(timeline_id + ' .av-milestone-placement-top .av-milestone-date'), true ); 32 33 //content 34 this.setMinHeight( $(timeline_id + ' .av-milestone-placement-bottom .av-milestone-content-wrap'), true ); 35 36 //contentbox 37 this.setMinHeight( $(timeline_id + ' .av-milestone-placement-bottom.avia-timeline-boxshadow .av-milestone-contentbox'), false ); 38 this.setMinHeight( $(timeline_id + ' .av-milestone-placement-top.avia-timeline-boxshadow .av-milestone-contentbox'), false ); 39 40 //alternate 41 this.setMinHeight( $(timeline_id + ' .avia-timeline-horizontal.av-milestone-placement-alternate li >:first-child'), true ); 42 43 }, 44 45 setMinHeight: function( els, setNav ) 46 { 47 48 if(els.length < 2) return; 49 50 var elsHeights = new Array(); 51 els.css('min-height','0').each(function(i) 52 { 53 var current = $(this); 54 var currentHeight = current.outerHeight(true); 55 elsHeights.push(currentHeight); 56 }); 57 58 var largest = Math.max.apply(null, elsHeights); 59 els.css('min-height', largest); 60 61 //set nav position 62 if (setNav) { 63 var $firstElement = els.first(), 64 $parent = $firstElement.closest('.avia-timeline-container'), 65 $pos = $firstElement.height(); 66 67 $parent.find('.av-timeline-nav').css('top',$pos); 68 } 69 70 }, 71 createCarousel : function(e){ 72 73 var self = this, 74 slider = $(timeline_id + '.avia-slideshow-carousel'), 75 slides_num = 3, 76 slides_num_small = 1; 77 78 if (timeline.attr('avia-data-slides')) { 79 slides_num = parseInt(timeline.attr('avia-data-slides')); 80 } 81 82 if (slides_num >= 2) { 83 slides_num_small = 2; 84 } 85 86 var sliderOptions = { 87 carousel : 'yes', 88 keep_pading : true, 89 carouselSlidesToShow : slides_num, 90 carouselSlidesToScroll : 3, 91 carouselResponsive : [ 92 { 93 breakpoint: 989, 94 settings: { 95 carouselSlidesToShow: slides_num_small, 96 carouselSlidesToScroll: slides_num_small, 97 } 98 }, 99 { 100 breakpoint: 767, 101 settings: { 102 carouselSlidesToShow: 1, 103 carouselSlidesToScroll: 1, 104 } 105 } 106 ], 107 } 108 109 slider.aviaSlider(sliderOptions); 110 111 slider.on('_kickOff',function(){ 112 self.matchHeights(); 113 }); 114 115 $(window).on( 'resize', function() { 116 self.matchHeights(); 117 }); 118 119 120 121 }, 122 layoutHelpers : function(e){ 123 124 $(timeline_id + ' .avia-timeline-vertical li').each(function(index, element){ 125 126 var $length = $(this).parents('ul').find('li').length; 127 128 var $icon_wrap = $(this).find('.av-milestone-icon-wrap'); 129 var $icon_wrap_height = $icon_wrap.outerHeight(true); 130 var $icon_wrap_height_half = parseInt($icon_wrap_height/2); 131 132 if (index === ($length - 1)) { 133 $icon_wrap.css({ 134 'height' : $icon_wrap_height_half, 135 }); 136 } 137 else { 138 $icon_wrap.css({ 139 'height' : $icon_wrap_height, 140 }); 141 } 142 143 }); 144 145 }, 146 fireAnimations : function(e) { 147 148 if ( $(timeline_id + ' > ul').hasClass('avia-timeline-vertical') ) { 149 var milestone = timeline.find('.av-milestone'); 150 timeline.on('avia_start_animation', function() { 151 milestone.each(function(i) 152 { 153 var element = $(this); 154 setTimeout(function(){ element.addClass('avia_start_animation') }, (i * 350)); 155 }); 156 }); 157 } 158 } 159 }; 160 methods.createCarousel(); 161 methods.layoutHelpers(); 162 methods.fireAnimations(); 163 methods.matchHeights(); 164 }); 165 } 166 167})(jQuery);
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.