/*******************************/ /* Publisher olibu. Front-js.js */ /*******************************/ //GNB Mouse on,oveer $(document).ready(function() { // GNB $('#gnb #gnb1_ul').hover(function(){ $('#gnb').addClass('on'); $('.gnb2_ul').css('display','block'); setTimeout(function(){ $('.gnb2_ul').addClass('on'); },500); }, function(){ $('#gnb').removeClass('on'); $('.gnb2_ul').css('display','none'); $('.gnb2_ul').removeClass('on'); }) // GNB End $("#gnb .gnb1_li").each(function(){ if ($(this).children("a").text() == $(".visual-tit").text() ){ $(this).children("a").css("color","#7d4698"); //$(this).children("a").css("border-bottom","1px solid #d21217"); } }); /** 스크롤이 설정한 높이 이상 내려갔을때 스타일추가하기*/ if (jQuery(window).width() > 0) { jQuery(window).on("scroll",function(ev){ if(jQuery(window).scrollTop() > 40 ) { jQuery('#header').addClass('bg_on'); jQuery('#m-header').addClass('on'); } else{ jQuery('#header').removeClass('bg_on'); jQuery('#m-header').removeClass('on'); } return false; }); } /* 스크롤이 설정한 높이 이상 내려갔을때 스타일추가하기 end */ //if (jQuery(window).width() > 0) { // jQuery(window).on("scroll",function(ev){ // if(jQuery(window).scrollTop() > 10 ) { // jQuery('#header').addClass('fixed'); // } // else{ // jQuery('#header').removeClass('fixed'); // } // return false; // }); // } // 스크롤 앵커이동 $('a.ps').click(function(){ $('html, body').animate({ scrollTop: $( $.attr(this, 'href') ).offset().top -80 }, 500); return false; }); /* 위로 스크롤이 특정 위치로 이동하면 위로버튼이 나타난다. 위로버튼을 클릭하면 상단으로 이동 */ function btn_mv_up(oj) { if(!oj) return false; var o = $(oj); var p = $(window).scrollTop(); if(p > 300){ o.fadeIn('slow'); } // 위로버튼이 나타나는 위치 지정 else if(p < 300){ o.fadeOut('slow'); } // 위로버튼을 숨기는 위치 지정 } // 위로 버튼 $(document).scroll(function() { btn_mv_up('.btn_up_layer'); }).on('click', '.btn_up_layer', function() { $("html, body").animate({scrollTop:0}, 'slow'); }); /* 모바일 바디 스크롤방지 */ var posY; $(".mOpener").on("click", function(e){ posY = $(window).scrollTop(); $("html, body").addClass("not_scroll"); $(".mMenu").css("display","block"); //$(".cont").css("top",-posY); }); $(".closer").on("click", function(){ $("html, body").removeClass("not_scroll"); // $(".mMenu").css("display","none"); posY = $(window).scrollTop(posY); }); $(".mask").on("click", function(){ $("html, body").removeClass("not_scroll"); // $(".mMenu").css("display","none"); posY = $(window).scrollTop(posY); }); /* 모바일 바디 스크롤방지 end */ /* *********************** 서브페이지 ON ************************ */ setTimeout(function () { $("#visual").addClass("active"); }); // file var fileTarget = $('.filebox_s .upload-hidden'); fileTarget.on('change', function(){ if(window.FileReader){ var filename = $(this)[0].files[0].name; } else { var filename = $(this).val().split('/').pop().split('\\').pop(); } // $(this).siblings('#nfile1_Text').val(filename); $(document).on("change", "#sfile1", function () { $('#sfile1_Text').val($('#sfile1').val()); }); $(document).on("change", "#sfile2", function () { $('#sfile2_Text').val($('#sfile2').val()); }); }); /* slide JS */ var swiper = new Swiper('#mainBn', { slidesPerView: 1, //화면에 보여질 슬라이드 갯수 pagination: { el: '.swiper1 .swiper-pagination', clickable: true, }, //navigation: { // nextEl: '.swiper1 .swiper-button-next', // prevEl: '.swiper1 .swiper-button-prev', // }, spaceBetween: 0, loop: true, autoplay: { delay: 6000, speed: 500, disableOnInteraction: false, }, }); // main slide /* slide JS end */ /* Toggle */ $('.submenuM').on('click', function(){ $(this).siblings('.submenu_toggle').stop().slideToggle(); }) /* tab */ //Default Action $(".tab_contentA").hide(); //Hide all content $("#organ li:first").addClass("active").show(); //Activate first tab $(".tab_contentA:first").show(); //Show first tab content //On Click Event $("#organ li").click(function() { $("#organ li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_contentA").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active content return false; }); /* tab end */ /* checkbox */ $.fn.cbFamily = function (children) { return this.each(function () { var $this = $(this); var els; if ($.isFunction(children)) { els = children.call($this); } else { els = $(children); } $this.bind("click.cbFamily", function () { els.prop('checked', this.checked).change(); }); function checkParent() { $this.prop('checked', els.length == els.filter("input:checked").length); } els.bind("click.cbFamily", function () { if ($this.prop('checked') && !this.checked) { $this.prop('checked', false).change(); } if (this.checked) { checkParent(); $this.change(); } }); // Check parents if required on initialization checkParent(); }); }; /* checkbox end */ });