1(function($) { 2 /** 3 * Extra JS for the Architekt theme 4 * 5 * 1. positions the different elements: 6 * - arrows 7 * - dots 8 * - caption 9 * - filmstrip 10 */ 11 12 // metaslider has been initilalised 13 $(document).on('metaslider/initialized', function(e, identifier) { 14 // if .ms-theme-architekt 15 if ($(identifier).closest('.metaslider.ms-theme-architekt').length) { 16 var $slider = $(identifier); 17 var $container = $(identifier).closest('.metaslider.ms-theme-architekt'); 18 var captions = $slider.find('.caption'); 19 if (captions.length) { 20 $container.addClass('ms-has-caption'); 21 } 22 $container.addClass('ms-loaded'); 23 } 24 $(window).trigger('resize'); 25 }); 26 27 $(window).on('resize', function(e) { 28 // go through the sliders with this theme 29 $('.metaslider.ms-theme-architekt').each(function(index) { 30 var width = $(this).outerWidth(); 31 // if the slider width < 600px 32 if (width < 600) { 33 $(this).addClass('ms-is-small'); 34 } else { 35 $(this).removeClass('ms-is-small'); 36 } 37 38 // slightly delay action after resize for a smoother transition 39 setTimeout(function() { 40 var margin_bottom = 0; 41 var $thumbNav = $(this).find('.filmstrip, .flex-control-thumbs, .nivo-thumbs-enabled'); 42 // gets the slideshow's height 43 var height = get_max_height($(this).find('.flexslider > ul > li img, .ms-image > img, .rslides > li > img, .nivoSlider > img')); 44 45 // if has filmstrip nav 46 if ($(this).find('.filmstrip').length) { 47 // var $thumbNav = $(this).find('.filmstrip'); 48 var thumbs_height = $thumbNav.find('img').prop('height'); 49 50 // Filmstrip position 51 if($(this).is('.ms-has-caption')) { 52 $thumbNav.css({'top': height + 5}); 53 } 54 55 // arrows position 56 $(this) 57 .find('.flex-control-nav, .flexslider .flex-direction-nav') 58 .css({'top': height + thumbs_height + 15, 'bottom': 'auto'}); 59 60 // caption position 61 $(this) 62 .find('.caption-wrap') 63 .css({'margin-top': thumbs_height}); 64 65 // margin_bottom += thumbs_height + 15; 66 } else if ($(this).find('.flex-control-thumbs, .nivo-thumbs-enabled').length) { 67 // var thumbs_height = $thumbNav.find('img').prop('height'); 68 // thumbnails for flex 69 // $(this).find('.flex-control-nav').css({'top': height, 'bottom': 'auto'}); 70 // Arrows 71 $(this).find('.flex-direction-nav, .nivo-directionNav').css({ 72 'top': Math.round(height + $thumbNav.outerHeight() + 6), 73 'bottom': 'auto' 74 }); 75 margin_bottom += $thumbNav.outerHeight(); 76 if ($(this).find('.flex-direction-nav').length) { 77 $(this).css('padding-bottom', margin_bottom + 15); 78 } 79 } else { 80 // arrows and dots position 81 $(this) 82 .find('.flex-control-nav, .flexslider:not(.filmstrip) .flex-direction-nav, .rslides_nav, .rslides_tabs, .nivo-directionNav, .nivo-controlNav') 83 .css({'top': height + 15, 'bottom': 'auto'}); 84 } 85 }.bind(this), 50); 86 }); 87 }); 88 89 /** 90 * Get maximum height of the elements collection 91 * 92 * @param {jQuery object} elms 93 * @return {int} 94 */ 95 var get_max_height = function(elms) { 96 var h = 0; 97 $(elms).each(function(index) { 98 if ($(this).height() > h) { 99 h = $(this).height(); 100 } 101 }); 102 return h; 103 } 104})(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.