1$(function() { 2 var mediaLG = window.matchMedia('(min-width: 992px)'); 3 4 initCommon(); // ê³µíµ 5 initHeader(); // í¤ë 6 initMain(); // ë©ì¸ 7 initSub(); // ìë¸ 8 9 /** 10 * ê³µíµ 11 */ 12 13 function initCommon() { 14 $('.carousel-box .prev-btn').on('click', function() { 15 $(this).closest('.carousel-box').find('.owl-carousel').trigger('prev.owl.carousel'); 16 }); 17 18 $('.carousel-box .next-btn').on('click', function() { 19 $(this).closest('.carousel-box').find('.owl-carousel').trigger('next.owl.carousel'); 20 }); 21 } 22 23 /** 24 * í¤ë 25 */ 26 function initHeader() { 27 var duration = 300; 28 29 // íë²ê±° ë©ë´ í´ë¦ 30 $('.nav-bg-fostrap').on('click', function() { 31 if (!mediaLG.matches) { 32 openMenu(); 33 } 34 }); 35 36 // íë²ê±° ë©ë´ ëª¨ë¬ ìì í´ë¦ 37 $('#mask').on('click', function() { 38 closeMenu(); 39 }); 40 41 $('.menubar-close').on('click', function() { 42 closeMenu(); 43 }); 44 45 $(window).on('resize', function() { 46 if (mediaLG.matches) { 47 closeMenu(); 48 } 49 }); 50 51 // 1 ëì¤ ë©ë´ í´ë¦ 52 var $firstMenuitems = $('.menubar > li > [role="menuitem"]'); 53 $firstMenuitems.on('click', function() { 54 if (!mediaLG.matches) { 55 $firstMenuitems.not(this).attr('aria-expanded', 'false'); 56 toggleMenuItemExpanded($(this)); 57 } 58 }); 59 60 // 2 ëì¤ ë©ë´ í´ë¦ 61 var $secondMenuitems = $('.menubar .menubox > .menubox-inner > [role="menu"] > li > [role="menuitem"]'); 62 $secondMenuitems.on('click', function() { 63 if (!mediaLG.matches) { 64 $secondMenuitems.not(this).attr('aria-expanded', 'false'); 65 toggleMenuItemExpanded($(this)); 66 } 67 }); 68 69 // window resize 70 $(window).on('resize', function() { 71 if (mediaLG.matches) { 72 closeMenu(); 73 resetMenu(); 74 } else { 75 $('.menubox').removeAttr('style'); 76 } 77 }); 78 79 var $headerBG = $('#header .header-bg'); 80 $('#header .menubar > li') 81 .on('mouseenter', function() { 82 $headerBG.addClass('on'); 83 }) 84 .on('mouseleave', function() { 85 $headerBG.removeClass('on'); 86 }); 87 88 $('.menubar > li').on('mouseenter', function() { 89 if (mediaLG.matches) { 90 var leftPos = $(this).offset().left; 91 var $menubox = $(this).find('.menubox'); 92 var menuboxWidth = $menubox[0].scrollWidth; 93 var topMainWidth = $('.top-main').outerWidth(); 94 var topMainLayoutWidth = $('.top-main-layout').outerWidth(); 95 var remainSide = (topMainWidth - topMainLayoutWidth) / 2; 96 var remain = (topMainLayoutWidth + remainSide) - (leftPos + menuboxWidth); 97 98 // .menuboxê° .top-main-layout ììì ë²ì´ ë¬ë¤ë©´ ë§ì§ì ì¡°ì íì¬ ìì¹ ì¡°ì 99 if (remain < 0) { 100 $menubox.css({ 101 'margin-left': (remain + 22) 102 }); 103 } 104 } 105 }); 106 107 function openMenu() { 108 $('#mask').fadeIn(duration); 109 $('.menubar-box').addClass('on'); 110 } 111 112 function closeMenu() { 113 $('#mask').fadeOut(duration); 114 $('.menubar-box').removeClass('on'); 115 } 116 117 function toggleMenuItemExpanded($menuItem) { 118 if ($menuItem.attr('aria-expanded') === 'true') { 119 $menuItem.attr('aria-expanded', 'false'); 120 } else { 121 $menuItem.attr('aria-expanded', 'true'); 122 } 123 } 124 125 function resetMenu() { 126 $('.menubar [role="menuitem"]').attr('aria-expanded', 'false'); 127 } 128 } 129 130 /** 131 * ë©ì¸ 132 */ 133 134 function initMain() { 135 initMainVisual() 136 initMainGallery(); // ê°¤ë¬ë¦¬ 137 initMainBanner(); // ë°°ë 138 139 function initMainVisual() { 140 $owlMV = $('.mv-carousel'); 141 if ($owlMV.length) { 142 $owlMV.owlCarousel({ 143 autoplay: true, 144 autoplayTimeout: 5000, 145 autoplayHoverPause: true, 146 dots: true, 147 items: 1, 148 loop: true 149 }); 150 addPlayPauseBtn($owlMV); 151 } 152 } 153 154 /* ê°¤ë¬ë¦¬ */ 155 function initMainGallery() { 156 $owlGallery = $('.gallery-carousel'); 157 if ($owlGallery.length) { 158 $owlGallery.owlCarousel({ 159 autoplay: true, 160 autoplayTimeout: 5000, 161 dots: false, 162 items: 1, 163 loop: true, 164 responsive: { 165 768: { 166 items: 2, 167 margin: 25 168 }, 169 992: { 170 items: 3, 171 margin: 25 172 } 173 } 174 }); 175 bindEventPlayPauseBtn($owlGallery, $('.gallery-carousel-box .play-pause-btn')); 176 } 177 } 178 179 /* ë°°ë */ 180 function initMainBanner() { 181 $owlBanner = $('.banner-carousel'); 182 if ($owlBanner.length) { 183 $owlBanner.owlCarousel({ 184 autoplay: true, 185 autoplayTimeout: 5000, 186 dots: true, 187 items: 1, 188 loop: true 189 // responsive: { 190 // 992: { 191 // items: 2, 192 // margin: 20 193 // }, 194 // 1200: { 195 // items: 1 196 // } 197 // } 198 }); 199 addPlayPauseBtn($owlBanner); 200 } 201 } 202 } 203 204 /** 205 * ìë¸ 206 */ 207 208 function initSub() { 209 210 } 211 212 /** 213 * ê³µíµ ì í¸ 214 */ 215 216 // Carouselìì dots ìì 기 217 function removeDots($carousel) { 218 $carousel.find('.owl-dots-wrapper').remove(); 219 } 220 221 // ìë ì¤í ë° ì¤ì§ ë²í¼ ì¶ê° 222 function addPlayPauseBtn($carousel) { 223 if(!$carousel.find('.play-pause-btn').length) { 224 var $playPauseBtn = $('<button type="button" class="play-pause-btn pause" aria-label="ì ì§"><span class="material-icons">pause</span></button>'); 225 226 bindEventPlayPauseBtn($carousel, $playPauseBtn); 227 228 if (!$carousel.data('owl.carousel').options.autoplay) { // autoplay ìµì ì´ falseë¼ë©´ 229 setPauseBtn($playPauseBtn, false); 230 } 231 232 $carousel.find('.owl-dots').wrap('<div class="owl-dots-wrapper"></div>'); 233 $carousel.find('.owl-dots-wrapper').append($playPauseBtn); 234 } 235 } 236 237 // ìë ì¤í ë° ì¤ì§ ë²í¼ ì´ë²¤í¸ ë°ì¸ë© 238 function bindEventPlayPauseBtn($carousel, $playPauseBtn) { 239 $playPauseBtn.on('click', function() { 240 if ($(this).is('.pause')) { 241 $carousel.trigger('stop.owl.autoplay'); 242 setPauseBtn($playPauseBtn, false); 243 } else { 244 $carousel.trigger('play.owl.autoplay'); 245 setPauseBtn($playPauseBtn, true); 246 } 247 }); 248 } 249 250 // ìë ì¤í ë° ì¤ì§ ë²í¼ ì¸í 251 function setPauseBtn($playPauseBtn, pause) { 252 if (pause) { 253 $playPauseBtn.removeClass('play'); 254 $playPauseBtn.addClass('pause'); 255 $playPauseBtn.attr('aria-label', 'ì ì§'); 256 $playPauseBtn.children('span').text('pause'); 257 } else { 258 $playPauseBtn.removeClass('pause'); 259 $playPauseBtn.addClass('play'); 260 $playPauseBtn.attr('aria-label', 'ìëì¤í'); 261 $playPauseBtn.children('span').text('play_arrow'); 262 } 263 } 264});
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.