1;(function($) { 2 3 var width = $( window ).width(); 4 5 var limit_word = (width > 1024) ? 42 : (width < 1024 || width > 767) ? 35 : 44; 6 7 function carouselAutoplay() { 8 var itemsNum, autoBol; 9 if (width > 1024) { 10 itemsNum = 6; 11 autoBol = false; 12 } else if (width < 1024 & width > 767) { 13 itemsNum = 3; 14 autoBol = true; 15 } else { 16 itemsNum = 1; 17 autoBol = true; 18 } 19 setting = { 20 margin: 5, 21 nav: true, 22 loop: true, 23 dots: false, 24 autoplay: autoBol, 25 autoplayTimeout: 4000, 26 items: itemsNum, 27 navText: ['<div class="nav-btn prev"></div>','<div class="nav-btn next"></div>'] 28 } 29 return setting; 30 } 31 32 function carouselSetup() { 33 $('#index-carousel').owlCarousel( 34 carouselAutoplay() 35 ); 36 carouselProgress(); 37 } 38 39 function carouselProgress() { 40 if (width < 1024) { 41 $('.owl-carousel').append('<div class="owl-progress"></div>'); 42 } 43 } 44 45 function trimString(targetClass, limit) { 46 $(targetClass).each(function(index, obj) { 47 var trimmedString = $(this).text().substr(0, limit); 48 var lastSpacing = trimmedString.lastIndexOf(" "); 49 var outer = $(this).text().substr(limit, $(this).text().length); 50 51 if ($(this).text().length > limit && lastSpacing > 0) { 52 if (outer.indexOf(" ") != 0) { 53 trimmedString = trimmedString.substr(0, Math.min(trimmedString.length, lastSpacing)); 54 outer = $(this).text().substr(lastSpacing , $(this).text().length); 55 } else { 56 //outer = outer.substr(trimmedString.length, $(this).length); 57 } 58 $(this).html(trimmedString + ' ...<p class="hidden-text">' + outer + '</p>'); 59 } 60 }); 61 } 62 63 // function navMenu() { 64 // $('.desktop-navItem > i.fab').click(function(){ 65 // var target = '#' + $(this).attr('data-child'); 66 67 // if ($(this).hasClass('active')) { 68 // $(this).removeClass('active'); 69 // $(target).addClass('hidden-imp'); 70 // $('header').removeClass('open-nav'); 71 // } else { 72 // $('.desktop-navItem > i.fab').removeClass('active'); 73 // $('#mainnav > .secondary-menu').addClass('hidden-imp'); 74 // $(this).addClass('active'); 75 // $(target).removeClass('hidden-imp'); 76 // $('header').addClass('open-nav'); 77 // } 78 // }) 79 // } 80 81 82 // DOM Ready 83 $(function() { 84 carouselSetup(); 85 //navMenu(); 86 }); 87 88 $(window).on('load', function() { 89 trimString(".carousel-title>a", limit_word); 90 }); 91 92})(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.