(function() { //submenu toggle /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var board = { 'overY' : function(){ $(".overY").each(function(){ var overHeight = $(this).height(); if (overHeight >= 44){ $(this).addClass("long"); } }); //댓글더보기 클릭시 내용 펼쳐짐 $(".btn_more").click(function(){ $(this).parent(".overY").removeClass("long"); }); }, 'notice' : function(){ if ($(".table_list tbody tr").hasClass('notice')){ $(this).addClass("noticeY"); } }, 'thumb' : function(){ $(document).mousemove(function(e){ var mouseX = e.pageX; var mouseY = e.pageY; $('.thumb_zoom').css({ left: mouseX + "px", top : mouseY + "px" }) }) } } var gnb = { 'submenu' : function(){ $(".subMenu").each(function(){ var subMenuLi = $(this).children("li").length; if (subMenuLi <= 1){ $(this).addClass("only"); } }); } } //submenu toggle /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var acodian = { click : function() { $(".sub_menu li p").on('click', function() { if ($(this).next(".depth3").css('display') == 'none') { $('.sub_menu li .depth3').slideUp(); $('.sub_menu li').removeClass('on'); $(this).parent("li").toggleClass("on"); $(this).next(".depth3").slideToggle(); } else { $('.depth3').slideUp(); $(this).parent("li").removeClass('on'); } }); } }; $("#fouc").css("opacity", "1"); // switch 체크 시 라인 active /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function checkSwitch() { $(document).on('click',".line",function(){ if(!$(".line").hasClass("modifying")){ $(".line").removeClass("active"); $(this).closest("li").toggleClass("active"); } }) } //// tab /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function tabs() { // Default Action $("ul.tabs").each(function() { $(this).children("li:first").addClass("active"); // Activate first tab $(this).parent(".tab_wrap").find(".tab_content").hide(); // Hide all tab content var activeTab = $(this).find("a").attr("href"); $(activeTab).show(); }); // On Click Event $("ul.tabs li").click(function() { $(this).parent("ul.tabs").children("li").removeClass("active");// Remove any "active" class $(this).addClass("active"); // Add "active" class to selected tab $(this).parent(".tabs").parent(".tab_wrap").find(".tab_content").hide(); // Hide all tab content var clickTab = $(this).find("a").attr("href"); // Find the rel $(clickTab).fadeIn(); // Fade in the active content return false; }); } //// popup /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var popup = { 'open' : function(){ $(".openpopup").each(function(){ var popupname = $(this).attr("name"); $(this).click(function(){ $("." + popupname).show().addClass("open"); }); }); }, 'close' : function(){ $(".close, .btn_close, .member_close").on('click', function(){ $(".modal, .member_wrap").removeClass("open"); }); } } //// 이미지 사이즈 함수 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function boardContentImg() { var img_length = $(".board_content img").length; var _div_width = $(".board_content").width(); var _div_height = $(".board_content").height(); for(var i=0;i 0) { var starFill = $(".reply_list_title .score").text() * 20; $(".star_fill").width(starFill + '%'); } } ///// img background //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var imgBg = { 'bgImg' : function() { $(".bg_box").each(function(){ var bg_box = $(this).children("img").attr("src"); $(this).css({backgroundImage: "url(" + bg_box + ")"}); }); }, //버튼 배경 이미지 넣기 'btnImg' : function() { $(".btn_img").each(function(){ var btn_img = $(this).children("img").attr("src"); $(this).css({backgroundImage: "url(" + btn_img + ")"}); }); } } ///// icon //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// var icon = { //icon 'icon' : function() { if (!('boxShadow' in document.body.style)) { document.body.setAttribute('class', 'noBoxShadow'); } document.body.addEventListener("click", function(e) { var target = e.target; if (target.tagName === "INPUT" && target.getAttribute('class').indexOf('liga') === -1) { target.select(); } }); } }; $(document).ready(function() { board.overY() //글이 긴 경우 더보기 board.notice() //공지사항 글이 있을 경우 board.thumb() //썸네일 확대 gnb.submenu() acodian.click(); //search clickEvent.toggle(); clickEvent.searchOpen(); clickEvent.searchClose(); clickEvent.estToggle(); clickEvent.inputCategory() //input category toggle clickEvent.btn_toggle(); clickEvent.arrowBtn(); //견적서 toggle clickEvent.estToggle(); //견적서 선택된 차종 리스트 toggle checkSwitch(); imgBg.bgImg() imgBg.btnImg() boardContentImg() //img 넓이가 부모요소의 넓이 이상 이면 100% 로 맞추기 tabs() star() popup.open() popup.close() inputFocus(); icon.icon(); }); }) ();