1/******************************** 2 * UI ì¤í¬ë¦½í¸ * 3 * ìì±ì : ìí¨ì£¼ * 4 ********************************/ 5$(document).ready(function () { 6 preLoading(); 7 deviceCheck(); 8 9 headerUI(); 10 footerUI(); 11 htmlInclude(); 12 commonUI(); 13 etcUI(); 14 popupUI(); 15 swiperInit(); 16 17 btnUI(); 18 tabUI(); 19 toggleUI(".btn_toggle_01", false); 20 scrollItem(); 21 contentTabSort(); 22 if ($(".ui-scroll-on").length > 0) scrollOn(); 23 footerFamilySet(); 24 $(window).load(function () { 25 $(window).resize(); 26 }); 27 28 $(".iframe").iFrameResize({ 29 log: false, // For development 30 autoResize: true, // Trigering resize on events in iFrame 31 contentWindowBodyMargin: 8, // Set the default browser body margin style (in px) 32 doHeight: true, // Calculates dynamic height 33 doWidth: false, // Calculates dynamic width 34 enablePublicMethods: true, // Enable methods within iframe hosted page 35 interval: 0, // interval in ms to recalculate body height, 0 to disable refreshing 36 scrolling: false, // Enable the scrollbars in the iFrame 37 callback: function (messageData) { 38 // Callback fn when message is received 39 /* $('p#callback').html( 40 '<b>Frame ID:</b> ' + messageData.iframe.id + 41 ' <b>Height:</b> ' + messageData.height + 42 ' <b>Width:</b> ' + messageData.width + 43 ' <b>Event type:</b> ' + messageData.type 44 ); 45 */ 46 }, 47 }); 48 49 /* ìíìì¸ ë보기 ë²í¼ í´ë¦ ì´ë²¤í¸ */ 50 $(document).on("click", ".btn-product-detail-toggle", function () { 51 if ($(".product-detail-img").hasClass("actived")) { 52 $(".product-detail-img").removeClass("actived"); 53 $(".btn-product-detail-toggle").removeClass("actived"); 54 } else { 55 $(".product-detail-img").addClass("actived"); 56 $(".btn-product-detail-toggle").addClass("actived"); 57 } 58 }); 59}); 60 61$(window).on("load", function () { 62 contentTabSort(); 63}); 64 65var contentTabSort = function () { 66 if ($(".page-tab-wrap").length > 0) { 67 var posX = 0; 68 $(".page-tab-wrap") 69 .find(".page-tab-cell") 70 .each(function () { 71 if ($(this).hasClass("on")) 72 posX = $(".page-tab-wrap").scrollLeft() + $(this).position().left; 73 }); 74 if (posX > $(window).width() / 2) $(".page-tab-wrap").scrollLeft(posX); 75 } 76}; 77 78var preLoading = function () { 79 var isAppPreLoading = sessionStorage.getItem("isPreLoading"), 80 $class = "pre_loading", 81 $imgarry = [ 82 "/app/themes/sknk/src/mobile/images/common/logo_white.svg", 83 "/app/themes/sknk/src/mobile/images/common/logo_red.svg", 84 "/app/themes/sknk/src/mobile/images/common/btn_gnb_open.png", 85 "/app/themes/sknk/src/mobile/images/common/btn_gnb_open2.png", 86 "/app/themes/sknk/src/mobile/images/common/head_search.png", 87 "/app/themes/sknk/src/mobile/images/common/head_search2.png", 88 "/app/themes/sknk/src/mobile/images/common/btn_gnb_close.png", 89 "/app/themes/sknk/src/mobile/images/common/btn_pop_close.png", 90 ]; 91 92 if (isAppPreLoading != "true") { 93 var $html = '<div class="' + $class + '">'; 94 for (var i in $imgarry) { 95 $html += 96 '<span style="background-image:url(' + $imgarry[i] + ');"></span>'; 97 } 98 $html += "</div>"; 99 100 sessionStorage.setItem("isPreLoading", true); 101 $("body").append($html); 102 } 103}; 104 105var isMobile = { 106 Android: function () { 107 return navigator.userAgent.match(/Android/i) == null ? false : true; 108 }, 109 110 BlackBerry: function () { 111 return navigator.userAgent.match(/BlackBerry/i) == null ? false : true; 112 }, 113 114 iOS: function () { 115 return navigator.userAgent.match(/iPhone|iPad|iPod/i) == null 116 ? false 117 : true; 118 }, 119 120 Opera: function () { 121 return navigator.userAgent.match(/Opera Mini/i) == null ? false : true; 122 }, 123 124 Windows: function () { 125 return navigator.userAgent.match(/IEMobile/i) == null ? false : true; 126 }, 127 128 any: function () { 129 return ( 130 isMobile.Android() || 131 isMobile.iOS() || 132 isMobile.BlackBerry() || 133 isMobile.Opera() || 134 isMobile.Windows() 135 ); 136 }, 137 add: function () { 138 if (isMobile.any()) { 139 if (isMobile.iOS()) $("html").addClass("ios"); 140 if (isMobile.Android()) $("html").addClass("android"); 141 } 142 }, 143}; 144
145var deviceCheck = function () { 146 isMobile.add(); 147}; 148 149var headerUI = function () { 150 var $header = $("#mo_header"), 151 $gnbTxt = $("#gnb a"), 152 $pageTitle = $("#pageTit"); //gnb, lnb, titleì ì°ì¼ í ì¤í¸ì§ì 153 $naviTitle = $("#pageTit").attr("data-naviText"); //gnb, lnb, titleì ì°ì¼ í ì¤í¸ì§ì 154 155 if ($pageTitle.length > 0 && !$("body").hasClass("main")) { 156 var $current = $.trim($pageTitle.text()); 157 // document.title = $current + " | ì¼ííì¸ ëª¨ë°ì¼"; //#pageTit ê° titleíê·¸ì ì½ì 158 159 if ($("#gnb").length) { 160 $gnbTxt.each(function () { 161 if ($(this).text() == $current || $(this).text() == $naviTitle) { 162 $(this).parents("li").addClass("active").addClass("on"); 163 $(this).parents("li").find("ul").css("display", "block"); 164 } else { 165 if ( 166 $(this).text() == "íì¸í ê°ì´ë" && 167 $pageTitle.text().indexOf("íì¸í ê°ì´ë") > -1 168 ) { 169 $(this).parents("li").addClass("active").addClass("on"); 170 $(this).parents("li").find("ul").css("display", "block"); 171 } 172 if ( 173 $(this).text() == "ë¶ììì¤í " && 174 $pageTitle.text() == "ë¶ì ì뢰í기" 175 ) { 176 $(this).parents("li").addClass("active").addClass("on"); 177 $(this).parents("li").find("ul").css("display", "block"); 178 } 179 } 180 }); 181 } 182 } 183 184 if ($("#pageTop").hasClass("visual")) { 185 $header.addClass("type2"); 186 } 187 if ($("#pageTop").hasClass("visual")) { 188 $("section#contents.mobile").addClass("type2"); 189 } 190 191 192 //GNB UI 193 $(".btn_gnb").click(function (e) { 194 e.preventDefault(); 195 if ($("body").hasClass("gnb_open")) { 196 $("body").removeClass("gnb_open"); 197 } else { 198 $("body").addClass("gnb_open"); 199 } 200 }); 201 $(".btn_gnb_open").on("click", function (e) { 202 e.preventDefault(); 203 $("body").addClass("gnb_open"); 204 }); 205 $(".btn_gnb_close").on("click", function (e) { 206 e.preventDefault(); 207 $("body").removeClass("gnb_open"); 208 }); 209 $("#gnb .in_sub").on("click", function (e) { 210 e.preventDefault(); 211 $(this).next("ul").stop().slideToggle(); 212 $(this) 213 .parent() 214 .toggleClass("on") 215 .siblings() 216 .removeClass("on") 217 .find("ul") 218 .slideUp(); 219 }); 220 221 //í¤ë ê²ìë²í¼ 222 $(".head_search").click(function (e) { 223 e.preventDefault(); 224 if ($("body").hasClass("search_open")) { 225 $("body").removeClass("search_open"); 226 } else { 227 $("body").addClass("search_open"); 228 } 229 $("html,body").scrollTop(0); 230 }); 231 $(".btn_search_close").on("click", function (e) { 232 e.preventDefault(); 233 $("body").removeClass("search_open"); 234 $("html,body").scrollTop(0); 235 }); 236 237 //ì¤í¬ë¡¤ ì(리ì¬ì´ì¦ ì) í¤ë ê³ ì , visual ì 238 if ($header.length > 0 && $("#contents").length > 0) { 239 $(window).on("scroll resize", function () { 240 var $scrollTop = $(this).scrollTop(), 241 $contTop = $("#contents").offset().top; 242 243 if ($scrollTop > $contTop) { 244 $header.addClass("fixed"); 245 } else { 246 $header.removeClass("fixed"); 247 } 248 249 if ($("#pageTop.visual").length > 0 && $header.hasClass("type2")) { 250 var $topStart = $("#pageTop").offset().top, 251 $topEnd = $("#pageTop").outerHeight(); 252 253 if ($scrollTop > $topStart + $topEnd) { 254 $header.addClass("on"); 255 } else { 256 $header.removeClass("on"); 257 } 258 $scrollTop = Math.max(0, $scrollTop - $topStart); 259 260 if ($("body").hasClass("main")) { 261 if ($scrollTop > 0) { 262 $(".main_bg").addClass("fixed"); 263 var $height = $(window).height() * 0.65, 264 $opacity = Math.max(0.5, Math.min(1, $scrollTop / $height)), 265 $opacity2 = 266 1 - Math.max(0, Math.min(0.9, $scrollTop / ($height * 0.5))); 267 $("#pageTit").css("opacity", $opacity); 268 $("#pageTit") 269 .next() 270 .css("opacity", 1 - $opacity); 271 $(".main_navi, .main_banner .cont").css("opacity", $opacity2); 272 } else { 273 $(".main_bg").removeClass("fixed"); 274 } 275 } else { 276 $("#pageTop.visual .bg").css("top", $scrollTop / 2); 277 } 278 } 279 }); 280 } 281}; 282 283var footerUI = function () { 284 //btnTop 285 $("#btnTop").on("click", function (e) { 286 e.preventDefault(); 287 $("html,body").animate({ scrollTop: 0 }, 500); 288 }); 289 $(".popBtnTop").on("click", function (e) { 290 e.preventDefault(); 291 $(this).closest(".pop_wrap").animate({ scrollTop: 0 }, 500); 292 }); 293}; 294 295var htmlInclude = function () { 296 var $elements = $.find("*[data-include-html]"); 297 if ($elements.length) { 298 $.each($elements, function () { 299 var $this = $(this), 300 $html = $this.data("include-html"), 301 $htmlAry = $html.split("/"), 302 $htmlLast = $htmlAry[$htmlAry.length - 1]; 303 304 $this.load($html, function (res, sta, xhr) { 305 if (sta == "success") { 306 console.log("Include " + $htmlLast + "!"); 307 $this.children().unwrap(); 308 if ($htmlLast == "header.asp") { 309 headerUI(); 310 $(window).resize(); 311 } 312 if ($htmlLast == "footer.asp") footerUI(); 313 } 314 }); 315 }); 316 } 317}; 318
319var commonUI = function () { 320 //focus 321 $(document) 322 .on("focusin", "input, select, textarea", function () { 323 $(this).addClass("focus"); 324 }) 325 .on("focusout", "input, select, textarea", function () { 326 $(this).removeClass("focus"); 327 }); 328 329 //input:file 330 $(document).on("focus", ".input_file .input", function () { 331 $(this).closest(".input_file").find(".btn_file input").trigger("click"); 332 }); 333 $(document).on("click", ".input_file .btn_file .button", function (e) { 334 e.preventDefault(); 335 $(this).closest(".btn_file").find("input").trigger("click"); 336 }); 337 $(document).on("change", ".input_file .btn_file input", function () { 338 $(this).closest(".input_file").find(".input").val($(this).val()); 339 }); 340 341 $("#file").on("change", function () { 342 var fileName = $("#file").val(); 343 $(".upload-name").val(fileName); 344 }); 345 //input-del : input ì ë ¥ ìì ë²í¼ 346 $(".input_del").each(function () { 347 var $parent = $(this).parent(); 348 if (!$parent.hasClass("input_box")) $parent.addClass("input_box"); 349 if ($(this).siblings(".btn_search").length > 0) $parent.addClass("type2"); 350 }); 351 $(document).on("click", ".input_del", function (e) { 352 e.preventDefault(); 353 var $input = $(this).siblings("input"); 354 $input.val("").focus(); 355 if ($(this).closest(".search_input").length) 356 $(this).closest(".search_input").removeClass("on"); 357 }); 358 $(document).on("keyup", ".search_input .input", function () { 359 var $val = $(this).val(); 360 if ($val != "") { 361 $(".search_input").addClass("on"); 362 } else { 363 $(".search_input").removeClass("on"); 364 } 365 }); 366 $(document).on("click", ".search_input .button", function () { 367 $(".search_input").removeClass("on"); 368 $(".search_input .input").val(""); 369 }); 370 371 $(document).on("keyup", ".input-wrap input", function () { 372 var $val = $(this).val(); 373 if ($val != "") { 374 $(".input-wrap").addClass("on"); 375 } else { 376 $(".input-wrap").removeClass("on"); 377 } 378 }); 379 $(document).on("click", ".input-wrap .button_del", function () { 380 $(".input-wrap").removeClass("on"); 381 $(".input-wrap input").val(""); 382 }); 383 384 //select_list 385 $(document).on("click", ".select_list > a", function (e) { 386 e.preventDefault(); 387 var $parent = $(this).parent(); 388 if ($parent.hasClass("on")) { 389 $parent.removeClass("on"); 390 } else { 391 $(".select_list").removeClass("on"); 392 $(this).parent().addClass("on"); 393 } 394 }); 395 $(document).on("click", ".select_list .option", function (e) { 396 if (!$(this).hasClass("link")) { 397 e.preventDefault(); 398 var $html = $(this).html(); 399 $(this).parent().addClass("selected").siblings().removeClass("selected"); 400 $(this) 401 .closest(".select_list") 402 .removeClass("on") 403 .children("a") 404 .html($html); 405 } 406 }); 407 408 //fake_select 409 $(document).on("change", ".fake_select select", function (e) { 410 var $selected = $(this).find(":selected"); 411 $(this).siblings("span").text($selected.text()); 412 }); 413}; 414 415var etcUI = function () { 416 //faq_list 417 $(document).on("click", ".faq_list > li > a", function (e) { 418 e.preventDefault(); 419 $(this) 420 .next("div") 421 .slideToggle(300) 422 .parent() 423 .toggleClass("on") 424 .siblings("li") 425 .removeClass("on") 426 .children("div") 427 .slideUp(300); 428 }); 429}; 430 431/* ë ì´ì´ íì */ 432var $popSpeed = 300, 433 $popOpenBtn = ""; 434var popupUI = function () { 435 $(document).on("click", ".ui-pop-open", function (e) { 436 e.preventDefault(); 437 var $pop = $(this).attr("href"); 438 popOpen($pop, this); 439 }); 440 $(document).on("click", ".ui-pop-close", function (e) { 441 e.preventDefault(); 442 var $pop = $(this).closest(".pop_wrap"); 443 popClose($pop); 444 }); 445 446 /* 447 //íì bg í´ë¦ì ë«í ê¸°ë¥ 448 $('.pop_wrap').on('click',function(){ 449 var $pop = $(this); 450 if(!$pop.hasClass('close_none')){popClose($pop);} //ë°°ê²½ í´ë¦ì ìë«íê² í ëë close_none í´ëì¤ ì¶ê°ë¡ ì²ë¦¬ 451 }).on('click','.popup',function(e) { 452 e.stopPropagation(); 453 }); 454 */ 455}; 456var popOpen = function (tar, btn) { 457 if ($(tar).length < 1 || $(tar).children(".popup").length < 1) 458 return console.log("í´ë¹íì ìì"); 459 var $visible = $(".pop_wrap:visible").size(); 460 if (btn != null || btn != window) $popOpenBtn = $(btn); 461 if ($visible > 0) { 462 $(tar).css("z-index", "+=" + $visible); 463 } 464 $("body").addClass("pop_open"); 465 $(tar).fadeIn($popSpeed, function () { 466 $(this).attr({ tabindex: 0 }).focus(); 467 }); 468 if ($sliders.length > 0 && $(tar).find(".ui-swiper").length > 0) { 469 for (var i in $sliders) { 470 $sliders[i].reInit(); 471 } 472 } 473 474 if ($(tar).find(".scale-img").length > 0) { 475 var img = $(tar).find(".scale-img"); 476 var imgUrl = $popOpenBtn.find("> img").attr("src"); 477 var imgAlt = $popOpenBtn.find("> img").attr("alt"); 478 img 479 .removeClass("actived")
480 .find(".img-data") 481 .html("") 482 .append('<img src="' + imgUrl + '" alt="' + imgAlt + '"/>') 483 .find("img") 484 .load(function () { 485 img.addClass("actived"); 486 }); 487 } 488}; 489var popClose = function (tar) { 490 var $visible = $(".pop_wrap:visible").size(); 491 if ($visible == 1) { 492 $("body").removeClass("pop_open"); 493 } 494 $(tar) 495 .find(".popup") 496 .animate({ "margin-top": 0 }, $popSpeed, function () { 497 $(this).removeAttr("style"); 498 }); 499 $(tar).fadeOut($popSpeed, function () { 500 $(tar).removeAttr("tabindex"); 501 if ($popOpenBtn != "") { 502 if ($popOpenBtn != window) { 503 $popOpenBtn.focus(); 504 } 505 $popOpenBtn = ""; 506 } 507 }); 508}; 509 510/* ë¤ì¤ Swiper */ 511var swiperInit = function () { 512 if ($(".ui-swiper").length > 0) multiSwiper(".ui-swiper"); 513}; 514var $sliders = []; 515var multiSwiper = function (tar) { 516 $(tar).each(function (i, element) { 517 var $list = $(this).find(".swiper-container"), 518 $prev = $(this).find(".ui-prev"), 519 $next = $(this).find(".ui-next"), 520 $pagination = $(this).find(".pagination"), 521 $length = $list.find(".swiper-slide").length; 522 523 //console.log($length); 524 525 $list.addClass("ui-swipe-s" + i); 526 if ($prev.length > 0) { 527 $prev.addClass("ui-swipe-l" + i); 528 } 529 if ($next.length > 0) { 530 $next.addClass("ui-swipe-r" + i); 531 } 532 if ($pagination.length > 0) { 533 $pagination.addClass("ui-swipe-p" + i); 534 } 535 var slider = new Swiper(".ui-swipe-s" + i, { 536 //slidesPerView:'auto', 537 calculateHeight: true, 538 pagination: ".ui-swipe-p" + i, 539 paginationClickable: true, 540 resizeReInit: true, 541 onInit: function (swiper) { 542 var wid = $(swiper.container).width(), 543 wid2 = $(swiper.container).find(".swiper-wrapper").width(); 544 $(".ui-swipe-l" + i).addClass("disabled"); 545 if (wid >= wid2) { 546 $(".ui-swipe-r" + i).addClass("disabled"); 547 } 548 }, 549 onSlideChangeStart: function (swiper) { 550 var $i = swiper.activeIndex, 551 $l = swiper.visibleSlides.length; 552 if ($i == 0) { 553 $(".ui-swipe-l" + i).addClass("disabled"); 554 } else { 555 $(".ui-swipe-l" + i).removeClass("disabled"); 556 } 557 if ($i + $l == $length) { 558 $(".ui-swipe-r" + i).addClass("disabled"); 559 } else { 560 $(".ui-swipe-r" + i).removeClass("disabled"); 561 } 562 }, 563 }); 564 565 $sliders.push(slider); 566 567 $(".ui-swipe-l" + i).click(function (e) { 568 e.preventDefault(); 569 $sliders[i].swipePrev(); 570 }); 571 $(".ui-swipe-r" + i).click(function (e) { 572 e.preventDefault(); 573 $sliders[i].swipeNext(); 574 }); 575 }); 576}; 577 578/* btn */ 579var btnUI = function () { 580 //aíê·¸ ë§í¬ '#', '#none' ì´ë ë°©ì§ 581 $(document).on("click", "a", function (e) { 582 var $href = $(this).attr("href"); 583 if ($href == "#" || $href == "#none") e.preventDefault(); 584 }); 585 $(document).on("click", ".button.disabled", function (e) { 586 return false; 587 }); 588 589 //ë²í¼ í´ë¦ í¨ê³¼ 590 $(document).on("click", ".button, .list_link", function (e) { 591 var $btnEl = $(this), 592 $delay = 650, 593 $href = $btnEl.attr("href"); 594 if ($href == "#" || $href == "#none") e.preventDefault(); 595 596 //if(!$btnEl.hasClass('disabled') && $btnEl.closest('.btn_wrap').size() > 0){ 597 if (!$btnEl.is(".disabled")) { 598 if ($btnEl.find(".btn_click_in").length == 0) 599 $btnEl.prepend('<i class="btn_click_in"></i>'); 600 var $btnIn = $btnEl.find(".btn_click_in"), 601 $btnMax = Math.max($btnEl.outerWidth(), $btnEl.outerHeight()), 602 $btnX = e.pageX - $btnEl.offset().left - $btnMax / 2, 603 $btnY = e.pageY - $btnEl.offset().top - $btnMax / 2; 604 605 $btnIn 606 .css({ 607 left: $btnX, 608 top: $btnY, 609 width: $btnMax, 610 height: $btnMax, 611 }) 612 .addClass("animate") 613 .delay($delay) 614 .queue(function (next) { 615 $btnIn.remove(); 616 next(); 617 }); 618 } 619 }); 620}; 621 622/* tab ê¸°ë¥ */ 623var tabSwiper; 624var tabUI = function () { 625 var $onText = '<span class="blind">íì¬ìì¹</span>'; 626 627 $(document).on("click", ".mobile .ui-tabmenu a", function (e) { 628 e.preventDefault(); 629 var href = $(this).attr("href"); 630 if (!$(this).parent().hasClass("on")) { 631 $(href).addClass("on").siblings(".tab_cont").removeClass("on"); 632 $(this) 633 .prepend($onText) 634 .parent() 635 .addClass("on") 636 .siblings() 637 .removeClass("on") 638 .find(".blind") 639 .remove(); 640 } 641 642 if ($sliders.length > 0 && $(href).find(".ui-swiper").length > 0) { 643 for (var i in $sliders) { 644 $sliders[i].reInit(); 645 } 646 } 647 648 //ì¹ ì ê·¼ì± ë³´ì 649 var $role = $(this).attr("role"); 650 if ($role == "tab") { 651 var $tabpanel = $(this).attr("aria-controls"); 652 $(this) 653 .attr("aria-selected", true) 654 .closest("li") 655 .siblings() 656 .find("[role=tab]") 657 .attr("aria-selected", false); 658 $("#" + $tabpanel) 659 .attr("aria-expanded", true) 660 .siblings("[role=tabpanel]") 661 .attr("aria-expanded", false); 662 } 663 }); 664 665 var $wrap = $(".tab_wrap"); 666 if ($wrap.length > 0) { 667 $(window).on("scroll resize", function () { 668 var $scrollTop = $(this).scrollTop(), 669 $haedH = $("#mo_header").outerHeight(); 670 671 $wrap.each(function (index, element) { 672 var $this = $(this), 673 $thisTop = $this.offset().top, 674 $height = $this.outerHeight(), 675 $st = Math.floor($thisTop) + $height; 676 677 $this.css("height", $height); 678 if ($st <= $scrollTop) { 679 $this.addClass("fixed"); 680 } else { 681 $this.removeClass("fixed"); 682 } 683 }); 684 }); 685 } 686 687 tabSwiper = $(".mobile .tabmenu.swiper-container").swiper({ 688 calculateHeight: true, 689 slidesPerView: "auto", 690 //resizeReInit: true, 691 onFirstInit: function (swiper) { 692 var $width = swiper.wrapper.clientWidth; 693 $(swiper.wrapper).css("width", $width + 10); 694 }, 695 onInit: function (swiper) { 696 var $width = swiper.wrapper.clientWidth; 697 $(swiper.wrapper).css("width", $width + 10); 698 }, 699 }); 700 if ($(".mobile .tabmenu").hasClass("prod_atta_lnb")) { 701 var $ldx = $(".swiper-wrapper li.on").index(); 702 //console.log($ldx) 703 tabSwiper.swipeTo($ldx); 704 } 705 /* 706 if($('.tabmenu').hasClass('color_lnb')){ 707 var $ldx = $('.swiper-wrapper li.on').index(); 708 //console.log($ldx) 709 tabSwiper.swipeTo($ldx) 710 } 711 */ 712 $(window).load(function () { 713 var $href = location.href; 714 715 if ($(".mobile .ui-tabmenu").length > 0) { 716 $(".mobile .ui-tabmenu").each(function (index, element) { 717 var $this = $(this); 718 $this.find("li").eq(0).find("a").trigger("click"); 719 }); 720 } 721 }); 722}; 723 724/* í ê¸ ê¸°ë¥ */ 725var $toggleSpeed = 500;
726var toggleUI = function (btn, isTxtChange) { 727 $(document).on("click", btn, function () { 728 if ($(this).hasClass("disabled")) return; 729 var $target, 730 isList = false; 731 if ($(this).parents(".toggle-list").size() > 0) { 732 $target = $(this).closest("li").find(".toggle_cont"); 733 isList = true; 734 } else { 735 $target = $(this).data("target"); 736 } 737 if ($($target).is(":animated")) return; 738 if ($(this).hasClass("on")) { 739 $(this).removeClass("on"); 740 if (isTxtChange) $(this).text("ìì¸ë³´ê¸° ì´ê¸°"); 741 $($target).stop().slideUp($toggleSpeed); 742 } else { 743 $(this).addClass("on"); 744 if (isTxtChange) $(this).text("ìì¸ë³´ê¸° ë«ê¸°"); 745 if (isList) { 746 $($target).closest("li").siblings().find(btn).removeClass("on"); 747 $($target) 748 .closest("li") 749 .siblings() 750 .find(".toggle_cont") 751 .not(".no-toggle") 752 .stop() 753 .slideUp($toggleSpeed); 754 } 755 $($target) 756 .stop() 757 .slideDown($toggleSpeed, function () { 758 toggleScroll(this); 759 }); 760 } 761 }); 762}; 763var toggleScroll = function (tar) { 764 var $scrollTop = $(window).scrollTop(), 765 $winH = $(window).height(), 766 $top = $(tar).offset().top, 767 $height = $(tar).outerHeight(), 768 $gap = $top + $height - ($scrollTop + $winH); 769 if ($(".btn_wrap.fixed").length > 0) 770 $gap += $(".btn_wrap.fixed").outerHeight(); 771 var $scroll = Math.min($top, $scrollTop + $gap); 772 if ($gap > 0) 773 $("html, body").stop().animate({ scrollTop: $scroll }, $toggleSpeed); 774}; 775 776/* ì¤í¬ë¡¤ ì ëë©ì´ì */ 777var scrollItem = function () { 778 var $elements = $.find("*[data-animation]"), 779 $window = $(window); 780 781 $(window).on("scroll resize", function () { 782 $elements = $.find("*[data-animation]"); 783 if ($elements.length > 0) { 784 checkInView(); 785 } 786 }); 787 788 function checkInView() { 789 var $wHeight = $window.height(), 790 $scrollTop = $window.scrollTop(), 791 $winBottom = $scrollTop + $wHeight - 50; 792 793 $.each($elements, function () { 794 var $el = $(this), 795 $elHeight = $($el).outerHeight(), 796 $elTop = $($el).offset().top, 797 $elBottom = $elTop + $elHeight, 798 $animationClass = $el.data("animation"), 799 $delay = $el.data("delay"), 800 $duration = $el.data("duration"), 801 $animationIn = $el.data("animation-in"); 802 803 if (!$el.hasClass("animated") && $animationClass != "on") { 804 if ($delay > 0) { 805 $el.css({ 806 "-webkit-animation-delay": $delay + "ms", 807 "animation-delay": $delay + "ms", 808 }); 809 } 810 if ($duration > 0) { 811 $el.css({ 812 "-webkit-animation-duration": $duration + "ms", 813 "animation-duration": $duration + "ms", 814 }); 815 } 816 $el.addClass("animated"); 817 } 818 if ($animationIn) { 819 if ($elTop >= $scrollTop && $elBottom <= $winBottom) { 820 $el.addClass($animationClass); 821 } else { 822 $el.removeClass($animationClass); 823 } 824 } else { 825 if ($elBottom >= $scrollTop && $elTop <= $winBottom) { 826 $el.addClass($animationClass); 827 } 828 } 829 }); 830 } 831}; 832 833function scrollOn() { 834 var tar = ".cr_case_wrap li", 835 navi = ".ui-scroll-on"; 836 837 $(".ui-scroll-on a").on("click", function (e) { 838 e.preventDefault(); 839 var $idx = $(this).closest("li").index(); 840 $scrollTop = $(tar).eq($idx).offset().top - 121; 841 $("html,body").animate({ scrollTop: $scrollTop }, 300); 842 }); 843 844 $(window).bind("scroll resize", function () { 845 var winH = $(window).height(), 846 scrollTop = $(this).scrollTop(), 847 center = scrollTop + winH / 2; 848 var idxArry = []; 849 $(tar).each(function (e) { 850 var secH = $(this).outerHeight(), 851 secS = $(this).offset().top; 852 853 if (center >= secS) { 854 idxArry.push(e); 855 } 856 }); 857 var $idxMax = Math.max.apply(null, idxArry); 858 859 $(navi) 860 .find(".swiper-slide") 861 .eq($idxMax) 862 .addClass("on") 863 .siblings() 864 .removeClass("on"); 865 $(tar).eq($idxMax).addClass("on").siblings().removeClass("on"); 866 tabSwiper.swipeTo($(navi).find(".swiper-slide.on").index()); 867 }); 868} 869 870/******************************** 871 ** plugins ** 872 *********************************/ 873(function ($) { 874 /* resizeEnd ì¬ì©ë² : (ê°ì ì리먼í¸ì ë¤ì¤ ì¬ì© ìë¨) 875 * $(window).resizeEnd(function(){console.log('resizeEnd');},300); 876 */ 877 $.fn.resizeEnd = function (callback, timeout) { 878 $(this).resize(function () { 879 var $this = $(this); 880 if ($this.data("resizeTimeout")) { 881 clearTimeout($this.data("resizeTimeout")); 882 } 883 $this.data("resizeTimeout", setTimeout(callback, timeout)); 884 }); 885 }; 886 887 /* scrollEnd ì¬ì©ë² : (ê°ì ì리먼í¸ì ë¤ì¤ ì¬ì© ìë¨) 888 * $(window).scrollEnd(function(){console.log('scrollEnd');},300); 889 */ 890 $.fn.scrollEnd = function (callback, timeout) { 891 $(this).scroll(function () { 892 var $this = $(this); 893 if ($this.data("scrollTimeout")) { 894 clearTimeout($this.data("scrollTimeout")); 895 } 896 $this.data("scrollTimeout", setTimeout(callback, timeout)); 897 }); 898 }; 899 900 /* changeClass ì¬ì©ë² : 901 * $(this).changeClass('on', 'off'); 902 */ 903 $.fn.changeClass = function (removeClassName, addClassName) { 904 var element = this; 905 element.removeClass(removeClassName).addClass(addClassName); 906 }; 907 908 /* addRemoveClass ì¬ì©ë² : 909 * $(this).addRemoveClass('on', 500, 1000); 910 */ 911 $.fn.addRemoveClass = function (className, addTime, removeTime) { 912 var element = this; 913 var addIt = function () { 914 element.addClass(className); 915 }; 916 var removeIt = function () { 917 element.removeClass(className); 918 }; 919 setTimeout(function () { 920 addIt(); 921 setTimeout(removeIt, removeTime); 922 }, addTime); 923 return this; 924 }; 925 926 /* scrollIn ì¬ì©ë² : 927 * $(this).scrollIn(); 928 * ios ë ìëë¡ì´ëìì focus() íìë ì¤í¬ë¡¤ ìëë íì ëì²´í¨ì 929 */ 930 $.fn.scrollIn = function () { 931 var $this = $(this), 932 $top = $this.offset().top, 933 $wrap = $("html, body"), 934 $height = $(window).height() - 50; 935 setTimeout(function () { 936 var $scrollTop = $(window).scrollTop(); 937 if ($top <= $scrollTop || $scrollTop + $height <= $top) { 938 $wrap.stop().animate({ scrollTop: $top - 50 }, 300); 939 } 940 }, 50); 941 return this; 942 }; 943})(jQuery); 944 945function footerFamilySet() { 946 $(document).on( 947 "click", 948 "#mo_footer .footer_bottom .relation_svc", 949 langSelectClickListener 950 ); 951} 952 953function langSelectClickListener() { 954 if ($(this).hasClass("active")) { 955 $(this).removeClass("active"); 956 } else { 957 $(this).addClass("active"); 958 } 959}
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.