From ea8b9ff88cccd717ed36c1f8555b8d56cbf0baec Mon Sep 17 00:00:00 2001 From: KNKIM Date: Fri, 22 Oct 2021 08:44:05 +0900 Subject: [PATCH] =?UTF-8?q?2=EC=B0=A8=20=ED=8D=BC=EB=B8=94=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EB=B6=84=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/webapp/js/default.js | 590 +++++++++++++++++++++------------- 1 file changed, 371 insertions(+), 219 deletions(-) diff --git a/src/main/webapp/js/default.js b/src/main/webapp/js/default.js index f0fcbafd..258b4e96 100644 --- a/src/main/webapp/js/default.js +++ b/src/main/webapp/js/default.js @@ -18,6 +18,278 @@ $(document).ready(function(){ } }); + /* 인기자료 탭메뉴 */ + (function ($) { + $('.tab ul.tabs').addClass('active').find('> li:eq(0)').addClass('current'); + $('.tab ul.tabs li a').click(function (g) { + var tab = $(this).closest('.tab'), + index = $(this).closest('li').index(); + + tab.find('ul.tabs > li').removeClass('current'); + $(this).closest('li').addClass('current'); + + tab.find('.tab_content').find('div.tabs_item').not('div.tabs_item:eq(' + index + ')').hide(); + tab.find('.tab_content').find('div.tabs_item:eq(' + index + ')').show(); + g.preventDefault(); + }); + })(jQuery); + + /* 푸터 관련사이트 */ + $(".family_site").click(function(){ + $(this).toggleClass("on"); + $(this) .find(".site_depth").slideToggle("fast"); + }); + + /* 로그인 팝업 */ + $(".login-btn").click(function(){ + $(".pop-login").fadeIn(); + }); + $(".pop-login .login-close").click(function(){ + $(".pop-login").fadeOut(); + }); + + /* 로그인 연결 팝업 */ + $(".login-connect-btn").click(function(){ + $(".pop-login-connect").fadeIn(); + }); + $(".pop-login-connect .login-close").click(function(){ + $(".pop-login-connect").fadeOut(); + }); + + /* 로그인 연결 패스워드 팝업 */ + $(".login-password-btn").click(function(){ + $(".pop-login-password").fadeIn(); + }); + $(".pop-login-password .login-close").click(function(){ + $(".pop-login-password").fadeOut(); + }); + + // scroll top button + $(window).scroll(function() { + var $window = $(window); + var $document = $(document); + var $footer = $('#footer'); + var $scrollBtn = $('#btn-go-top'); + + $scrollBtn.on('click', function () { + $("html, body").stop().animate({ + scrollTop: 0 + }, 600); + return false; + }); + + btnXPosition(); + $window.resize(function () { + btnXPosition(); + }); + + // top버튼 x좌표설정 + function btnXPosition() { + var rightPosition = ($document.width() - 1756) / 2 + + // X position + if($document.width() > 1756) { + //$scrollBtn.css('right', rightPosition); + $scrollBtn.css('right', '25px'); + } else { + $scrollBtn.css('right', '25px'); + } + } + + $window.on('scroll', function () { + if ($window.scrollTop() < $document.height() - $window.height() - $footer.outerHeight() + 37) { + $scrollBtn.addClass('go-top-fix'); + } else { + $scrollBtn.removeClass('go-top-fix'); + } + + if ($window.scrollTop() < ($window.height() / 3)) { + $scrollBtn.addClass('go-top-hide'); + } else { + $scrollBtn.removeClass('go-top-hide'); + } + }); + }); + + // 상세검색 팝업 - 문화원정보 선택영역 초기작업 메서드 분리 + jQuery(function($) { + var depth2H = 0; + $('.pop-advanced-search .depth1-check input').each(function () { + + if ($(this).is(":checked")) { // 활성화 line에 높이 잡아주기 + $('.depth1').removeClass('on'); + $(this).parents('.depth1').addClass('on'); + depth2H = $(this).parents('.depth1-check').next('.depth2').outerHeight(); + $(this).parents('.line').siblings('.line').attr('style', ''); + $(this).parents('.line').height(depth2H + 50); + } + + var tabLabel = $(this).next().text(); + $(this).parent('.depth1-check').append(''); + + $(this).siblings('.tab-name').on('click', function() { + $('.depth1').removeClass('on'); + $(this).parents('.depth1').addClass('on'); + depth2H = $(this).parents('.depth1-check').next('.depth2').outerHeight(); + $('.line').attr('style', ''); + $(this).parents('.line').height(depth2H + 50); + }); + + }); + + $('.pop-advanced-search .depth2 input').change(function() { + if ($(this).is(':checked')) { + $(this).parents('.depth2').siblings('.depth1-check').find('input').prop('checked', true); + } else { + if ($(this).parents('.depth2').find('input:checked').length <= 0) { + $(this).parents('.depth2').siblings('.depth1-check').find('input').prop('checked', false); + } + } + }); + + // depth-1 열고 닫기 + $('.filter-tit .btn-toggle').on('click', function() { + if($(this).text() == '닫기') { + $(this).text('열기'); + $(this).parent('.filter-tit').siblings('.filter-list').stop().slideUp(); + $('.filter .btn-toggle-more').css('display','none'); + } else { + $(this).text('닫기'); + $(this).parent('.filter-tit').siblings('.filter-list').stop().slideDown(); + $('.filter .btn-toggle-more').css('display','block'); + } + }); + + // depth-2 열고 닫기 + $('.filter .depth-1 .btn-toggle').on('click', function () { + var _this = $(this).parents('li').index(); + if ($(this).text() == '닫기') { + $(this).text('열기'); + $(this).siblings('.check').find('.tab-name').trigger("click"); + } else { + $(this).text('닫기'); + $(this).siblings('.check').find('.tab-name').trigger("click"); + } + }); + + $('.filter-wrap .tab-name').on('click', function() { + if ($('body').hasClass('pop-filter')) { + $(this).parents('.depth-1').removeClass('on'); + } + }); + + // 상세검색 팝업 열기 + $('.btn-search-detail').on('click', function () { + + // 클릭 시, 컨텐츠 로딩되도록 처리 (2021.10.20 DDDDDDDDDD 추가) : 시작 + $("#NLIB_LAYER_POPUP").addClass("popup pop-advanced-search"); + $("#NLIB_LAYER_POPUP").load("/search/getDetailedSearchFormPopup.do"); + // 클릭 시, 컨텐츠 로딩되도록 처리 (2021.10.20 DDDDDDDDDD 추가) : 종료 + + + $('.pop-advanced-search').fadeIn(); + $('html,body').addClass('no-scroll'); + }); + + //팝업닫기버튼 클릭 + $('.btn-close-pop').on('click', function () { + $(this).parents('.popup').fadeOut(); + $('html,body').removeClass('no-scroll'); + }); + }); + + // 회원가입 셀렉트박스 + jQuery(function($) { + var now = new Date(); + var year = now.getFullYear(); + var mon = (now.getMonth() + 1) > 9 ? ''+(now.getMonth() + 1) : '0'+(now.getMonth() + 1); + var day = (now.getDate()) > 9 ? ''+(now.getDate()) : '0'+(now.getDate()); + // 년도 + for(var i = 1900 ; i <= year ; i++) { + $('#year').append(''); + } + + // 월별 + for(var i=1; i <= 12; i++) { + var mm = i > 9 ? i : "0"+i ; + $('#month').append(''); + } + + // 일별 + for(var i=1; i <= 31; i++) { + var dd = i > 9 ? i : "0"+i ; + $('#day').append(''); + } + $("#year > option[value="+year+"]").attr("selected", "true"); + $("#month > option[value="+mon+"]").attr("selected", "true"); + $("#day > option[value="+day+"]").attr("selected", "true"); + }); + + // 회원가입 체크박스 + $('input.sex[type="checkbox"]').bind('click',function() { + $('input.sex[type="checkbox"]').not(this).prop("checked", false); + }); + + // 회원가입 체크박스 + $('input.ser-chk1[type="checkbox"]').bind('click',function() { + $('input.ser-chk1-1[type="checkbox"]').not(this).prop("checked", true); + + if($("input.ser-chk1").prop("checked")){ + $("input.ser-chk1-1[type=checkbox]").prop("checked",true); + }else{ + $("input.ser-chk1-1[type=checkbox]").prop("checked",false); + } + }); + + // 회원가입 체크박스 + $('input.ser-chk2[type="checkbox"]').bind('click',function() { + $('input.ser-chk2-2[type="checkbox"]').not(this).prop("checked", true); + + if($("input.ser-chk2").prop("checked")){ + $("input.ser-chk2-2[type=checkbox]").prop("checked",true); + }else{ + $("input.ser-chk2-2[type=checkbox]").prop("checked",false); + } + }); + + // 소장자료 디테일 목차정보 + $('.down-btn').click(function(){ + if($('.down-btn').hasClass('on') === false) { + $(this).addClass('on'); + $('.h-down').css('height','auto'); + } else { + $(this).removeClass('on'); + $('.h-down').css('height',''); + } + }); + + // 공유하기 팝업 + $('.share').click(function(){ + $('.pop-sharing').fadeIn(); + }); + // 닫기 + $('.pop-sharing .btn-close-pop').on('click', function () { + $('.pop-sharing').fadeOut(); + }); + + // 비밀번호 변경 팝업 + $('.pop-change-btn').click(function(){ + $('.pop-change').fadeIn(); + }); + // 닫기 + $('.change-close, .close').on('click', function () { + $('.pop-change').fadeOut(); + }); + + // 알림 아코디언 + $('.list-accordion .question').on('click', function() { + $('.list-accordion .answer').stop().slideUp(300); + $(this).next('.answer').stop().slideDown(300); + + $('.list-accordion .question').removeClass('on'); + $(this).addClass('on'); + }); + /* 메인 메뉴 반응형 */ jQuery(function($) { $.fn.responsivenav = function(args) { @@ -224,237 +496,117 @@ $(document).ready(function(){ $('#top-nav').responsivenav({responsive:false}); }); /* 메인 메뉴 반응형 end */ - - /* 인기자료 탭메뉴 */ - (function ($) { - $('.tab ul.tabs').addClass('active').find('> li:eq(0)').addClass('current'); - $('.tab ul.tabs li a').click(function (g) { - var tab = $(this).closest('.tab'), - index = $(this).closest('li').index(); - - tab.find('ul.tabs > li').removeClass('current'); - $(this).closest('li').addClass('current'); - - tab.find('.tab_content').find('div.tabs_item').not('div.tabs_item:eq(' + index + ')').hide(); - tab.find('.tab_content').find('div.tabs_item:eq(' + index + ')').show(); - g.preventDefault(); - }); - })(jQuery); - - /* 푸터 관련사이트 */ - $(".family_site").click(function(){ - $(this).toggleClass("on"); - $(this) .find(".site_depth").slideToggle("fast"); - }); - - /* 로그인 팝업 */ - $(".login-btn").click(function(){ - $(".pop-login").fadeIn(); - }); - $(".pop-login .login-close").click(function(){ - $(".pop-login").fadeOut(); - }); - - /* 로그인 연결 팝업 */ - $(".login-connect-btn").click(function(){ - $(".pop-login-connect").fadeIn(); - }); - $(".pop-login-connect .login-close").click(function(){ - $(".pop-login-connect").fadeOut(); - }); - - /* 로그인 연결 패스워드 팝업 */ - $(".login-password-btn").click(function(){ - $(".pop-login-password").fadeIn(); - }); - $(".pop-login-password .login-close").click(function(){ - $(".pop-login-password").fadeOut(); - }); - // scroll top button - $(window).scroll(function() { - var $window = $(window); - var $document = $(document); - var $footer = $('#footer'); - var $scrollBtn = $('#btn-go-top'); +}); - $scrollBtn.on('click', function () { - $("html, body").stop().animate({ - scrollTop: 0 - }, 600); - return false; - }); - btnXPosition(); - $window.resize(function () { - btnXPosition(); - }); - // top버튼 x좌표설정 - function btnXPosition() { - var rightPosition = ($document.width() - 1756) / 2 - // X position - if($document.width() > 1756) { - //$scrollBtn.css('right', rightPosition); - $scrollBtn.css('right', '25px'); - } else { - $scrollBtn.css('right', '25px'); - } - } - $window.on('scroll', function () { - if ($window.scrollTop() < $document.height() - $window.height() - $footer.outerHeight() + 37) { - $scrollBtn.addClass('go-top-fix'); - } else { - $scrollBtn.removeClass('go-top-fix'); - } - if ($window.scrollTop() < ($window.height() / 3)) { - $scrollBtn.addClass('go-top-hide'); - } else { - $scrollBtn.removeClass('go-top-hide'); - } - }); - }); - - // 상세검색 팝업 - 문화원정보 선택영역 초기작업 메서드 분리 - jQuery(function($) { - var depth2H = 0; - $('.pop-advanced-search .depth1-check input').each(function () { +// 검색 필터 관련 +$(document).ready(function() { + // depth-1 열고 닫기 + $('.filter-tit .btn-toggle').on('click', function() { + if($(this).text() == '닫기') { + $(this).text('열기'); + $(this).parent('.filter-tit').siblings('.filter-list').stop().slideUp(); + $('.filter .btn-toggle-more').css('display','none'); + } else { + $(this).text('닫기'); + $(this).parent('.filter-tit').siblings('.filter-list').stop().slideDown(); + $('.filter .btn-toggle-more').css('display','block'); + } + }); + + // depth-2 열고 닫기 + $('.filter .depth-1 .btn-toggle').on('click', function () { + var _this = $(this).parents('li').index(); + if ($(this).text() == '닫기') { + $(this).text('열기'); + $(this).siblings('.check').find('.tab-name').trigger("click"); + } else { + $(this).text('닫기'); + $(this).siblings('.check').find('.tab-name').trigger("click"); + } + }); + + $('.filter-wrap .tab-name').on('click', function() { + if ($('body').hasClass('pop-filter')) { + $(this).parents('.depth-1').removeClass('on'); + } + }); - if ($(this).is(":checked")) { // 활성화 line에 높이 잡아주기 - $('.depth1').removeClass('on'); - $(this).parents('.depth1').addClass('on'); - depth2H = $(this).parents('.depth1-check').next('.depth2').outerHeight(); - $(this).parents('.line').siblings('.line').attr('style', ''); - $(this).parents('.line').height(depth2H + 50); - } + //더보기 버튼 + $('.filter .btn-toggle-more').on('click', function() { + if($(this).text() == '더보기') { + $(this).text('접기'); + $(this).addClass('on'); + $(this).siblings('.filter-list').children('ul').children('li').css('display', 'block'); + } else { + $(this).text('더보기'); + $(this).removeClass('on'); + $(this).siblings('.filter-list').children('ul').children('li').each(function () { + if($(this).index() > 3) { + $(this).css('display','none'); + } + }); + } + }); - var tabLabel = $(this).next().text(); - $(this).parent('.depth1-check').append(''); + // 하위 리스트 보기 + $('.filter-wrap .depth-1 .check input').each(function () { + var tabLabel = $(this).next().text(); + if($(this).parents('.depth-1').siblings('.depth-2').length > 0) { //하위 조건이 있을 경우만 버튼 생성 + $(this).parent('.check').append(''); + } - $(this).siblings('.tab-name').on('click', function() { - $('.depth1').removeClass('on'); - $(this).parents('.depth1').addClass('on'); - depth2H = $(this).parents('.depth1-check').next('.depth2').outerHeight(); - $('.line').attr('style', ''); - $(this).parents('.line').height(depth2H + 50); - }); + $(this).siblings('.tab-name').on('click', function () { + var _this = $(this).parents('li').index(); - }); + $(this).parents('li').siblings('li').find('.depth-1').removeClass('on'); + if (!$('body').hasClass('pop-filter')) { + if ($(this).parents('.depth-1').hasClass('on')) { + $(this).parents('.depth-1').removeClass('on'); + } else { + $(this).parents('.depth-1').addClass('on'); + } + } else { + $(this).parents('.depth-1').addClass('on'); + } + + // 줄구분용 data 추가 + $(".pop-culture-center .line-1").data("idx", "1"); + $(".pop-culture-center .line-2").data("idx", "2"); + $(".pop-culture-center .line-3").data("idx", "3"); - $('.pop-advanced-search .depth2 input').change(function() { - if ($(this).is(':checked')) { - $(this).parents('.depth2').siblings('.depth1-check').find('input').prop('checked', true); - } else { - if ($(this).parents('.depth2').find('input:checked').length <= 0) { - $(this).parents('.depth2').siblings('.depth1-check').find('input').prop('checked', false); - } - } - }); + target = $(".pop-filter li.line-" + $(this).parents("li").data("idx") + ""); + size = $(this).parents("div.depth-1").next().outerHeight() + 50 ; + $(".line-1 , .line-2, .line-3").attr("style" , ''); + target.css("height" , size ); + + }); - // depth-1 열고 닫기 - $('.filter-tit .btn-toggle').on('click', function() { - if($(this).text() == '닫기') { - $(this).text('열기'); - $(this).parent('.filter-tit').siblings('.filter-list').stop().slideUp(); - $('.filter .btn-toggle-more').css('display','none'); - } else { - $(this).text('닫기'); - $(this).parent('.filter-tit').siblings('.filter-list').stop().slideDown(); - $('.filter .btn-toggle-more').css('display','block'); - } - }); + $(this).change( function () { + var _this = $(this).parents('li').index(); + if ($(this).is(":checked")) { + $(this).parents('.depth-1').next().stop().slideDown(0); + $(this).parents('.depth-1').addClass('on'); + $(this).parents('li').siblings('li').find('.depth-1').children('.btn-toggle').text('열기'); + $(this).parents('li').find('.depth-1').children('.btn-toggle').text('닫기'); + $(this).parents('li').siblings('li').find('.depth-1').next().stop().slideUp(0); + $(this).parents('li').siblings('li').find('.depth-1').removeClass('on'); + } + }); + }); - // depth-2 열고 닫기 - $('.filter .depth-1 .btn-toggle').on('click', function () { - var _this = $(this).parents('li').index(); - if ($(this).text() == '닫기') { - $(this).text('열기'); - $(this).siblings('.check').find('.tab-name').trigger("click"); - } else { - $(this).text('닫기'); - $(this).siblings('.check').find('.tab-name').trigger("click"); - } - }); - - $('.filter-wrap .tab-name').on('click', function() { - if ($('body').hasClass('pop-filter')) { - $(this).parents('.depth-1').removeClass('on'); - } - }); - - // 상세검색 팝업 열기 - $('.btn-search-detail').on('click', function () { - - // 클릭 시, 컨텐츠 로딩되도록 처리 (2021.10.20) - $("#NLIB_LAYER_POPUP").addClass("popup pop-advanced-search"); - $("#NLIB_LAYER_POPUP").load("/search/getDetailedSearchFormPopup.do"); - - $('.pop-advanced-search').fadeIn(); - $('html,body').addClass('no-scroll'); - }); - - //팝업닫기버튼 클릭 - $('.btn-close-pop').on('click', function () { - $(this).parents('.popup').fadeOut(); - $('html,body').removeClass('no-scroll'); - }); - }); - - // 회원가입 셀렉트박스 - jQuery(function($) { - var now = new Date(); - var year = now.getFullYear(); - var mon = (now.getMonth() + 1) > 9 ? ''+(now.getMonth() + 1) : '0'+(now.getMonth() + 1); - var day = (now.getDate()) > 9 ? ''+(now.getDate()) : '0'+(now.getDate()); - // 년도 - for(var i = 1900 ; i <= year ; i++) { - $('#year').append(''); - } - - // 월별 - for(var i=1; i <= 12; i++) { - var mm = i > 9 ? i : "0"+i ; - $('#month').append(''); - } - - // 일별 - for(var i=1; i <= 31; i++) { - var dd = i > 9 ? i : "0"+i ; - $('#day').append(''); - } - $("#year > option[value="+year+"]").attr("selected", "true"); - $("#month > option[value="+mon+"]").attr("selected", "true"); - $("#day > option[value="+day+"]").attr("selected", "true"); - }); - - // 회원가입 체크박스 - $('input.sex[type="checkbox"]').bind('click',function() { - $('input.sex[type="checkbox"]').not(this).prop("checked", false); - }); - - // 회원가입 체크박스 - $('input.ser-chk1[type="checkbox"]').bind('click',function() { - $('input.ser-chk1-1[type="checkbox"]').not(this).prop("checked", true); - - if($("input.ser-chk1").prop("checked")){ - $("input.ser-chk1-1[type=checkbox]").prop("checked",true); - }else{ - $("input.ser-chk1-1[type=checkbox]").prop("checked",false); - } - }); - - // 회원가입 체크박스 - $('input.ser-chk2[type="checkbox"]').bind('click',function() { - $('input.ser-chk2-2[type="checkbox"]').not(this).prop("checked", true); - - if($("input.ser-chk2").prop("checked")){ - $("input.ser-chk2-2[type=checkbox]").prop("checked",true); - }else{ - $("input.ser-chk2-2[type=checkbox]").prop("checked",false); - } - }); - + $('.filter-wrap .depth-2 input').change(function () { + if ($(this).is(':checked')) { + $(this).parents('.depth-2').siblings('.depth-1').find('input').prop('checked', true); + } else { + if ($(this).parents('.depth-2').find('input:checked').length <= 0) { + $(this).parents('.depth-2').siblings('.depth-1').find('input').prop('checked', false); + } + } + }); }); \ No newline at end of file