/** * 대한속기협회 공통 스크립트 * * @author web publisher * @since 2021.10.20 * */ $(function() { mMenu(); popProfile(); var w = $(window).width(); var x = 1024; // 화면 최상단 이동 $(".btn_top").click(function(e){ e.preventDefault(); $("html, body").stop().animate({"scrollTop": 0}, 300); }); $(window).scroll(function(){ if($(window).scrollTop() > 75){ $(".btn_top").fadeIn(300); }else{ $(".btn_top").fadeOut(300); } }); var snsList=false; $(".sns_share > button").on("click", function(e) { e.preventDefault(); $(".sns_share").toggleClass("on"); if(snsList){ $(this).text("SNS공유"); } else { $(this).text("SNS닫기"); } snsList=!snsList; }); var fileList=false; $(".ico_file").on("click", function(e){ e.preventDefault(); $(this).toggleClass("on"); if(fileList){ $(this).attr("title", "파일 리스트 보기"); }else{ $(this).attr("title", "파일 리스트 닫기"); } fileList=!fileList; }); $(".btn_global").on("click", function(e){ e.preventDefault(); $(this).toggleClass("on"); }); $(".btn_menu_close").click(function(){ $(".mask").removeClass("on"); $(".m_menu").removeClass("on"); return false; }); $(".mask").click(function(){ $(".mask").removeClass("on"); $(".m_menu").removeClass("on"); $(".pop_profile").removeClass("on"); $("body").removeClass("on"); }); $(".mask, #search .btn_close").on("click", function(e){ e.preventDefault(); $("#search, body").removeClass("on"); }); $("#search .btn_search").on("click", function(e){ e.preventDefault(); $("#search, body").addClass("on"); }); $(".linksite > li > a").attr("title", "링크 열기"); $(".linksite > li > a").on("click", function(e){ e.preventDefault(); $(".linksite > li > a").attr("title", "링크 열기"); var index = $(".linksite > li > a").index(this); var check = $(this).parent().attr("class"); if(check != "on"){ $(".linksite > li > div").each(function(){ $(this).slideUp("300"); }); $(".linksite > li > a").each(function(){ $(this).parent().removeClass("on"); }); $(".linksite > li > div").eq(index).slideDown("300"); $(".linksite > li > a").eq(index).parent().addClass("on"); $(this).attr("title", "링크 닫기"); } else { $(".linksite > li > div").eq(index).slideUp("300"); $(".linksite > li > a").parent().removeClass("on"); $(this).attr("title", "링크 열기"); } }); /* $('.linksite').mouseleave(function() { $('.linksite > li').removeClass("on"); $('.linksite > li > div').slideUp("300"); $(".linksite > li > a").attr("title", "링크 열기"); }); $("a").filter(":not(.linksite > li a)").focus(function(){ $('.linksite > li > a').removeClass("on"); $('.linksite > li > div').slideUp("300"); $(".linksite > li > a").attr("title", "링크 열기"); });*/ }); // 글자확대축소 var seemSize = 1; function zoomIn(){ seemSize *= 1.1; zoom(); if(seemSize > 1.3) { alert("최대 화면크기입니다"); seemSize = 1.3; return false; } } function zoomCur(){ seemSize = 1; zoom(); } function zoomOut(){ seemSize /= 1.1; zoom(); if(seemSize < 0.8) { alert("최소 화면크기입니다"); seemSize = 0.8; return false; } } function zoom() { document.body.style.transform = 'scale('+seemSize+')'; document.body.style.transformOrigin='50% 0 0'; } // 프린트페이지 function init(print) { if(print == "print") { document.getElementById("printInfo").style.display = "none"; // printInfo 문구 삭제 this.print(); } else { try { document.getElementById("docuPrint").innerHTML = opener.getPageDocuHtml(); this.focus(); } catch (err){} } } // 인쇄 function getPageDocuHtml() { return document.getElementById("content").innerHTML; } function globalShow(showpop) { $(".global").children().each(function() { if ($(this).children().filter("div").first().attr("id") == showpop) { if ($(this).children().filter("div").first().css("display") == "none") { $(this).children().filter("div").first().slideDown("fast"); $(this).children("a").addClass("on"); if ($(this).hasClass("list")){ $(this).children("a").attr("title", "링크 닫기"); } } else { $(this).children().filter("div").first().slideUp("fast"); $(this).children("a").removeClass("on"); if ($(this).hasClass("list")){ $(this).children("a").attr("title", "링크 열기"); } } } else { $(this).children().filter("div").first().hide(); $(this).children("a").removeClass("on"); if ($(this).hasClass("list")){ $(this).children("a").attr("title", "링크 열기"); } } }); /* $('.global').mouseleave(function() { $('.global > li > a').removeClass("on"); $(".global > .list > a").attr("title", "링크 열기"); $('.global > li > div').slideUp("fast"); }); $("a").filter(":not(.global > li a)").focus(function(){ $('.global > li > a').removeClass("on"); $(".global > .list > a").attr("title", "링크 열기"); $('.global > li > div').slideUp("fast"); }); */ } $(window).bind("load resize", function() { mMenu(); popProfile(); }); function mMenu() { $(".bt_sitemap").click(function(){ var w = $(window).width(); var x = 1024; var m_height=$(document).height(); if (w <= x) { $(".mask").addClass("on"); $(".m_menu").css({height:m_height+"px"}); $(".m_menu").addClass("on"); return false; } else { $(".mask").removeClass("on"); $(location).attr('href', '/source/guide/sitemap.html'); }; }); var w = $(window).width(); var x = 1024; if (w > x) { $(".mask").removeClass("on"); }; if (w <= x && $(".m_menu").hasClass("on")) { $(".mask").addClass("on"); }; } function popProfile() { $(".btn_profile").click(function(){ $(".mask").addClass("on"); var index = $(".btn_profile").index(this); var check = $(".pop_profile").attr("class"); if(check != "on"){ $(".pop_profile").each(function(){ $(this).removeClass("on"); }); $(".pop_profile").eq(index).addClass("on"); } else { $(".pop_profile").removeClass("on"); } }); $(".btn_p_close a").click(function(){ $(".mask").removeClass("on"); $(this).parents().find(".pop_profile").removeClass("on"); }); }