$(document).ready(function(){ //»ó´Ü¹è³Ê mainBannerSlider(); //°³Àμ­ºñ½º, »ç¾÷Àå¼­ºñ½º $(".service-wrap.service1 .btn-open").on("click",function(e){ e.preventDefault(); $(".service-wrap.service1").addClass("active"); $(".service-wrap.service2").removeClass("active"); $(".service-wrap.service1 ul").find("a").first().focus(); }); $(".service-wrap.service2 .btn-open").on("click",function(e){ e.preventDefault(); $(".service-wrap.service2").addClass("active"); $(".service-wrap.service1").removeClass("active"); $(".service-wrap.service2 ul").find("a").first().focus(); }); //»õ¼Ò½Ä $(".main-news .news-tab .active a").attr("title", "¼±ÅõÊ"); $(".news-tab a").on("click",function(e){ e.preventDefault(); var target= $(this).attr("href"); $(this).parent().siblings(".active").children("a").removeAttr("title"); $(this).parent().siblings(".active").removeClass("active"); $(this).parent().addClass("active"); $(this).attr("title", "¼±ÅõÊ"); $(target).siblings().removeClass("active") $(target).addClass("active"); activeChange(target); }); var w = $(window).width(); if(w > 768){ $(".news-slider-wrap").each(function(index){ var index = index+1; var target = "#" + $(this).parent().attr("id"); var slider = target + " .news-slider"; var slider_btn_prev = "#news"+index+" .btn-prev"; var slider_btn_next = "#news"+index+" .btn-next"; var newsSlider = new Swiper(slider , { loop: true, speed:700, spaceBetween: 25, slidesPerView: 3, navigation: { prevEl: slider_btn_prev, nextEl: slider_btn_next }, observer: true, observeParents: true }); //activeChange(target); $(slider_btn_prev).on("click", function(){ activeChange(target); }); $(slider_btn_next).on("click", function(){ activeChange(target); }); }); } activeChange("#news1"); function activeChange(target){ $(target).find(".swiper-slide").children().attr("tabIndex","-1"); setTimeout(function(){ $(target).find(".swiper-slide-active").children().attr("tabIndex","0"); $(target).find(".swiper-slide-active").next().children().attr("tabIndex","0"); $(target).find(".swiper-slide-active").next().next().children().attr("tabIndex","0"); }); } //Æ˾÷Á¸ popupzoneSlider(); //»çȸ°ü°è¸Á ¼­ºñ½º $(".main-sns .sns-type .active").attr("title", "¼±ÅõÊ"); $(".sns-type a").on("click", function(e){ e.preventDefault(); var target = $(this).attr("href"); $(this).siblings(".active").removeAttr("title"); $(this).siblings(".active").removeClass("active"); $(this).addClass("active"); $(this).attr("title", "¼±ÅõÊ"); $(target).siblings(".active").removeClass("active"); $(target).addClass("active"); }); //quick ´õº¸±â $(".quick-wrap .btn-more").on("click",function(){ var $quick = $(".quick-wrap"); if($quick.hasClass("full")){ $quick.removeClass("full"); $(this).text("´õº¸±â"); }else{ $quick.addClass("full"); $(this).text("¼û±â±â"); $quick.find("li:nth-child(6)").children("a").focus(); } }); }) function mainBannerSlider(){ var perView = 1; //º¸¿©Áú °¹¼ö var mainSlider = new Swiper('.banner-slider', { loop: true, speed:700, autoplay: { delay: 3000, }, navigation: { prevEl: '.banner-slider-nav .btn-prev', nextEl: '.banner-slider-nav .btn-next' }, pagination: { el: '.banner-slider-nav .slider-page', type: "fraction", clickable: true, }, }); var $btnStop = $(".banner-slider-nav .btn-stop"); $btnStop.click(function(e){ e.preventDefault(); if($(this).hasClass("play")){ sliderPlay(); }else{ sliderStop(); } }); function sliderStop(){ $btnStop.addClass("play"); $btnStop.text("ÀÚµ¿½½¶óÀÌµå ½ÃÀÛ"); mainSlider.autoplay.stop(); } function sliderPlay(){ $btnStop.removeClass("play"); $btnStop.text("ÀÚµ¿½½¶óÀÌµå ¸ØÃã"); mainSlider.autoplay.start(); } //Æ÷Ä¿½º var lastItem = perView; $(document).on("focus", ".banner-slider .swiper-slide-active a", function(){ sliderStop(); }); $(document).on("blur", ".banner-slider .swiper-slide a", function(e){ if($(e.target).parent().attr("data-swiper-slide-index") == lastItem){ sliderPlay(); } }); //Æ÷Ä¿½ºµÉ ¾ÆÀÌÅÛ newSliderChanage(); mainSlider.on("transitionStart", function(){ newSliderChanage(); }); function newSliderChanage(){ $(".banner-slider .swiper-slide a").attr("tabIndex", "-1"); $(".banner-slider .swiper-slide-active a").attr("tabIndex", "0"); var $activeSlider = $(".banner-slider .swiper-slide-active"); if(1 < perView){ for(var i=1; i<=perView-1;i++){ $activeSlider = $activeSlider.next(); $activeSlider.children("a").attr("tabIndex", "0"); } } lastItem = $activeSlider.attr("data-swiper-slide-index"); } } function popupzoneSlider(){ var perView = 1; //º¸¿©Áú °¹¼ö var popupzoneSlider = new Swiper('.popupzone-slider', { loop: true, speed:700, autoplay: { delay: 3000, }, navigation: { prevEl: '.popupzone-slider-nav .btn-prev', nextEl: '.popupzone-slider-nav .btn-next' }, pagination: { el: '.popupzone-slider-nav .slider-page', type: "fraction", clickable: true, }, }); var $btnStop = $(".popupzone-slider-nav .btn-stop"); $btnStop.click(function(e){ e.preventDefault(); if($(this).hasClass("play")){ sliderPlay(); }else{ sliderStop(); } }); function sliderStop(){ $btnStop.addClass("play"); $btnStop.text("ÀÚµ¿½½¶óÀÌµå ½ÃÀÛ"); popupzoneSlider.autoplay.stop(); } function sliderPlay(){ $btnStop.removeClass("play"); $btnStop.text("ÀÚµ¿½½¶óÀÌµå ¸ØÃã"); popupzoneSlider.autoplay.start(); } //Æ÷Ä¿½º var lastItem = perView; $(document).on("focus", ".popupzone-slider .swiper-slide-active a", function(){ sliderStop(); }); $(document).on("blur", ".popupzone-slider .swiper-slide a", function(e){ if($(e.target).parent().attr("data-swiper-slide-index") == lastItem){ sliderPlay(); } }); newSliderChanage(); popupzoneSlider.on("transitionStart", function(){ newSliderChanage(); }); function newSliderChanage(){ $(".popupzone-slider .swiper-slide a").attr("tabIndex", "-1"); $(".popupzone-slider .swiper-slide-active a").attr("tabIndex", "0"); var $activeSlider = $(".popupzone-slider .swiper-slide-active"); if(1 < perView){ for(var i=1; i<=perView-1;i++){ $activeSlider = $activeSlider.next(); $activeSlider.children("a").attr("tabIndex", "0"); } } lastItem = $activeSlider.attr("data-swiper-slide-index"); } }