1+function ($) { 2 "use strict"; 3 4 var LocationSlider = function (element, options) { 5 var self = this; 6 self.$element = $(element); 7 self.options = options; 8 9 var callbacks = { 10 start: function (slider) { 11 self.fixVerticalSlideSmoothHeight(slider); 12 $(window).resize(function () { self.fixVerticalSlideSmoothHeight(slider); }); 13 }, 14 after: function (slider) { 15 self.fixVerticalSlideSmoothHeight(slider); 16 } 17 }; 18 19 $.extend(self.options, callbacks); 20 21 self.attachEvents(); 22 self.initializeSlider(); 23 24 return self; 25 } 26 27 LocationSlider.prototype.attachEvents = function () { 28 var self = this; 29 if (self.options.direction === 'vertical') $(window).resize(function () { self.fixVerticalSlideHeight();}); 30 } 31 32 LocationSlider.prototype.initializeSlider = function () { 33 var self = this; 34 self.$bxSlider = self.$element.flexslider(self.options); 35 if (self.options.direction === 'vertical') self.fixVerticalSlideHeight(); 36 self.controlsWrap(); 37 } 38 39 LocationSlider.prototype.fixVerticalSlideHeight = function () { 40 var self = this, 41 maxHeight = 0, 42 slides = self.$element.find('.slides'); 43 44 slides.children().height('auto').each(function () { 45 maxHeight = Math.max(maxHeight, $(this).height()); 46 }).height(maxHeight); 47 48 slides.height(maxHeight); 49 } 50 51 LocationSlider.prototype.fixVerticalSlideSmoothHeight = function (slider) { 52 var self = this; 53 if (self.options.direction === 'vertical' && self.options.smoothHeight == 1) { 54 var activeSlideHeight = $(slider).find('.flex-active-slide > div').height(); 55 $(slider).find('.flex-viewport').height(activeSlideHeight); 56 } 57 } 58 59 LocationSlider.prototype.controlsWrap = function() { 60 var $flexBullets = this.$element.find('.flex-control-nav'), 61 $flexArrowPrev = this.$element.find('.flex-direction-nav .flex-prev'), 62 $flexArrowNext = this.$element.find('.flex-direction-nav .flex-next'); 63 64 this.$element.append("<div class='controls-wrapper'></div>"); 65 var $controlsWrap = this.$element.find('.controls-wrapper'); 66 67 if ($flexBullets.length) { 68 $controlsWrap.append($flexBullets); 69 $flexArrowPrev.insertBefore($flexBullets); 70 $flexArrowNext.insertAfter($flexBullets); 71 } else { 72 $controlsWrap.append($flexArrowPrev, $flexArrowNext); 73 } 74 75 this.$element.find('.flex-direction-nav').remove(); 76 77 if (this.$element.find('.slides li:not(.clone)').length == 1) $controlsWrap.remove(); 78 } 79 80 LocationSlider.DEFAULTS = { 81 easing: null, 82 useCSS: false 83 } 84 85 var old = $.fn.LocationSlider; 86 87 $.fn.LocationSlider = function (option) { 88 var args = arguments, result, obj; 89 90 var $this = $(this); 91 LocationSlider.DEFAULTS.controlsContainer = $('.flex-control-nav', $(this).parent()); 92 LocationSlider.DEFAULTS.customDirectionNav = $('.controls-wrapper a', $(this).parent()); 93 var options = $.extend({}, LocationSlider.DEFAULTS, $this.data(), typeof option == 'object' && option); 94 var data = ''; 95 96 return new LocationSlider(this, options); 97 }; 98 99 $.fn.LocationSlider.Constructor = LocationSlider 100 101 $.fn.LocationSlider.noConflict = function () { 102 $.fn.LocationSlider = old 103 } 104 105 $(window).load(function () { 106 var $locationSection = $(".locations.slider .flexslider"); 107 if ($locationSection.length) { 108 $locationSection.each(function () { 109 $(this).LocationSlider(); 110 }); 111 } 112 }); 113 114}(window.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.