$(function(){ gambitchk(); inView(); slickSlide(); CallbackNiceScroll(); $(document).on("click",".main_work .cate_l li",function(){ $(".main_work .cate_l li").removeClass("on"); $(this).addClass("on"); }); }); function formCheck() { // 폼체크 if ($("#i_privacy").is(":checked") === false){ alert('이용약관에 동의해주세요.'); $('#i_privacy').focus(); return false; } if ($("#i_terms").is(":checked") === false){ alert('개인정보보호방침에 동의해주세요.'); $('#i_terms').focus(); return false; } if ($('#i_id').val() == ""){ alert('아이디를 입력해주세요.'); $('#i_id').focus(); return false; } if ($('#i_pw').val() == ""){ alert('비밀번호를 입력해주세요.'); $('#i_pw').focus(); return false; } if ($('#i_name').val() == ""){ alert('이름을 입력해주세요.'); $('#i_name').focus(); return false; } if ($('#i_store').val() == ""){ alert('매장명을 입력해주세요.'); $('#i_store').focus(); return false; } if ($('#i_email1').val() == ""){ alert('이메일을 입력해주세요.'); $('#i_email1').focus(); return false; } if ($('#i_email2').val() == ""){ alert('이메일을 입력해주세요.'); $('#i_email2').focus(); return false; } if ($('#i_tel').val() == ""){ alert('핸드폰번호를 입력해주세요.'); $('#i_tel').focus(); return false; } } function slickSlide() { //history $historySlide = $('#history_slide'); $historySlide.slick({ infinite: false, swipe: true, variableWidth: false, arrows: true, dots:true, slidesToShow: 4, slidesToScroll: 4, appendDots: $('.history_indicator_g'), prevArrow: $('.history_arr_g').find('.prev'), nextArrow: $('.history_arr_g').find('.next'), responsive: [ { breakpoint: 1280, settings: { slidesToShow: 2, slidesToScroll: 2, //slidesPerRow: 2, } }, ], }); var $totalCount = Math.ceil($historySlide.find('.item').length/2); $totalCount < 10 ? $totalCount = '0'+$totalCount : $totalCount = $totalCount; $('.history_pager .total').text($totalCount); $historySlide.on('beforeChange', function(event, slick, currentSlide, nextSlide){ var $pageCount = nextSlide/2+1; $pageCount < 10 ? $pageCount = '0'+$pageCount : $pageCount = $pageCount; $('.history_pager .now').text($pageCount); }); } function inView() { var $animation_elements = $('.a_'); var $window = $(window); function check_if_in_view() { var window_height = $window.height(); var window_top_position = $window.scrollTop(); var window_bottom_position = (window_top_position + window_height); $.each($animation_elements, function() { var $element = $(this); var element_height = $element.outerHeight(); var element_top_position = $element.offset().top+200; var element_bottom_position = (element_top_position + element_height); //console.log(element_top_position); //check to see if this current container is within viewport if ((element_bottom_position >= window_top_position) && (element_top_position <= window_bottom_position)) { $element.addClass('in-view'); } else { //$element.removeClass('in-view'); } }); } $window.on('scroll resize', check_if_in_view); $window.trigger('scroll'); } function gambitchk (){ var agent = navigator.userAgent.toLowerCase(); if ((navigator.appName == 'Netscape' && navigator.userAgent.search('Trident') != -1) || (agent.indexOf("msie") != -1)) { //ie window.gambitScrollWheelAmount = 26; } else { //etc window.gambitScrollWheelAmount = 8; } } function CallbackNiceScroll() { $('html').niceScroll({ cursorcolor: "#fff", cursorwidth: 6, scrollspeed: 40, cursorborderradius: 0, mousescrollstep: 40, cursoropacitymin: 0, cursoropacitymax: 1, background: "none", cursorborder: "none", autohidemode: false, boxzoom: false, smoothscroll: true, zindex:10, }); $('.bbs_popup_view_content').niceScroll({ cursorcolor: "#666666", cursorwidth: 6, scrollspeed: 40, cursorborderradius: 0, mousescrollstep: 40, cursoropacitymin: 0, cursoropacitymax: 1, background: "none", cursorborder: "none", autohidemode: false, boxzoom: false, smoothscroll: true, zindex:10, }); } function CallBackWorkPopupJs (){ var $imgClick = 0; //products slide $('#bbs_popup_view_g .watchmore_layout').slick({ fade: false, slidesToShow: 4, slidesToScroll: 4, variableWidth: false, autoplay:false, speed: 400, pauseOnHover:false, pauseOnFocus:false, arrows: true, dots: false, cssEase:'linear', prevArrow: $('.watchmore_arr_g').find('.prev'), nextArrow: $('.watchmore_arr_g').find('.next'), responsive: [ { breakpoint: 1280, settings: { slidesToShow: 3, slidesToScroll: 3, } }, { breakpoint: 768, settings: { slidesToShow: 1, slidesToScroll: 1, } } ], }); if(typeof $.fn.Slick === 'undefined'){ $imgClick = 1; //드래그, 모션 중일때 호출 $('#bbs_popup_view_g .watchmore_layout').on('swipe', function(event, slick, direction){ $imgClick = 0; }); //슬라이드 후 호출 $('#bbs_popup_view_g .watchmore_layout').on('afterChange', function(event, slick){ $imgClick = 1; }); } //Watch More 슬라이드 $('.watchmore_layout .item').on('click', function(){ if($imgClick == 0){ return; } var dataNum = $(this).data('idx'); var c_code = $(this).data('c_code'); $.ajax({ type : "POST" //"POST", "GET" , async : true //true, false , url : "/work_popup_view.php" //Request URL , dataType : "html" //전송받을 데이터의 타입 , timeout : 30000 //제한시간 지정 , cache : false //true, false , data : "idx="+dataNum+"&c_code="+c_code //서버에 보낼 파라메터 , error : function(request, status, error) { //통신 에러 발생시 처리 console.log(error); } , success : function(html) { $('#bbs_popup_view_g').remove(); $('.portfolio_g').after(html); $('#wrap').addClass('portfolio'); CallBackWorkPopupJs(); CallbackNiceScroll(); } , complete: function() { //통신이 완료된 후 처리 gsap.to('#bbs_popup_view_g', .3, {opacity:1, ease: 'none', delay:0.3}); } }); }); //팝업 이전, 다음 $('.bbs_popup_view_b .page_btn_g .btn').on('click', function(){ var dataNum = $(this).data('idx'); var c_code = $(this).data('c_code'); $.ajax({ type : "POST" //"POST", "GET" , async : true //true, false , url : "/work_popup_view.php" //Request URL , dataType : "html" //전송받을 데이터의 타입 , timeout : 30000 //제한시간 지정 , cache : false //true, false , data : "idx="+dataNum+"&c_code="+c_code //서버에 보낼 파라메터 , error : function(request, status, error) { //통신 에러 발생시 처리 console.log(error); } , success : function(html) { $('#bbs_popup_view_g').remove(); $('.portfolio_g').after(html); $('#wrap').addClass('portfolio'); $('#dataNum').val(dataNum); CallBackWorkPopupJs(); CallbackNiceScroll(); } , complete: function() { //통신이 완료된 후 처리 gsap.to('#bbs_popup_view_g', .3, {opacity:1, ease: 'none', delay:0.3}); } }); }); $('#bbs_popup_view_g').click(function(e) { if(!$(e.target).parents().hasClass("bbs_popup_view_b")) { $('#bg').hide(); $('#bbs_popup_view_g').remove(); $('#wrap').removeClass('portfolio'); $('#wrap').removeClass('contest'); $('#wrap').removeClass('news-popup'); } }); } //무한스크롤 리스트 모션 function workMotionJS(code) { if(($('html').is('.mobile')) && ($('#main').is('.main_work'))) return; var vw = $(window).width(); var titlebox = '.main_work .title_box'; //mobile return if(vw <= 767) return; CallbackWorkMotion('.portfolio_l .item'); CallbackWorkMotion2('.contest_l .item'); CallbackWorkMotion3('.brand_magazine_l .item'); } function CallbackWorkMotion(selector) { var vw = $(window).width(); var init = { selector : selector+':nth-child', img : '.img_g .b_b', txt : '.item_text', thumb : new Array(), title : new Array(), } gsap.set($(selector).find(init.img), {y:'120%'}); gsap.set($(selector).find(init.txt), {y:'120%', opacity: 0}); if((vw >= 768) && (vw <= 1279)) { //tablet init.thumb = [ init.selector+'(3n-2) '+init.img, init.selector+'(3n-1) '+init.img, init.selector+'(3n) '+init.img, ]; init.title = [ init.selector+'(3n-2) '+init.txt, init.selector+'(3n-1) '+init.txt, init.selector+'(3n) '+init.txt, ]; } else { //pc init.thumb = [ init.selector+'(5n-4) '+init.img, init.selector+'(5n-3) '+init.img, init.selector+'(5n-2) '+init.img, init.selector+'(5n-1) '+init.img, init.selector+'(5n) '+init.img, ]; init.title = [ init.selector+'(5n-4) '+init.txt, init.selector+'(5n-3) '+init.txt, init.selector+'(5n-2) '+init.txt, init.selector+'(5n-1) '+init.txt, init.selector+'(5n) '+init.txt, ]; } gsap.to(init.thumb, .8, { stagger : 0.05, y:'0%', ease:'power4.out' }); gsap.to(init.title, .8, { stagger : 0.05, y:'0%', opacity: 1, ease:'power4.out', }); } function CallbackWorkMotion2(selector) { var vw = $(window).width(); var init = { selector : selector+':nth-child', img : '.img_g .b_b', txt : '.item_text', thumb : new Array(), title : new Array(), } gsap.set($(selector).find(init.img), {y:'120%'}); gsap.set($(selector).find(init.txt), {y:'120%', opacity: 0}); if((vw >= 768) && (vw <= 1279)) { //tablet init.thumb = [ init.selector+'(3n-2) '+init.img, init.selector+'(3n-1) '+init.img, init.selector+'(3n) '+init.img, ]; init.title = [ init.selector+'(3n-2) '+init.txt, init.selector+'(3n-1) '+init.txt, init.selector+'(3n) '+init.txt, ]; } else { //pc init.thumb = [ init.selector+'(4n-3) '+init.img, init.selector+'(4n-2) '+init.img, init.selector+'(4n-1) '+init.img, init.selector+'(4n) '+init.img, ]; init.title = [ init.selector+'(4n-3) '+init.txt, init.selector+'(4n-2) '+init.txt, init.selector+'(4n-1) '+init.txt, init.selector+'(4n) '+init.txt, ]; } gsap.to(init.thumb, 1, { stagger : 0.05, y:'0%', ease:'power4.out' }); gsap.to(init.title, 1, { stagger : 0.05, y:'0%', opacity: 1, ease:'power4.out', }); } function CallbackWorkMotion3(selector) { var vw = $(window).width(); var init = { selector : selector+':nth-child', img : '.img_g .b_b', thumb : new Array(), } gsap.set($(selector).find(init.img), {y:'120%'}); if((vw >= 768) && (vw <= 1279)) { //tablet init.thumb = [ init.selector+'(3n-2) '+init.img, init.selector+'(3n-1) '+init.img, init.selector+'(3n) '+init.img, ]; } else { //pc init.thumb = [ init.selector+'(7n-6) '+init.img, init.selector+'(7n-5) '+init.img, init.selector+'(7n-4) '+init.img, init.selector+'(7n-3) '+init.img, init.selector+'(7n-2) '+init.img, init.selector+'(7n-1) '+init.img, init.selector+'(7n) '+init.img, ]; } gsap.to(init.thumb, .8, { stagger : 0.05, y:'0%', ease:'power4.out' }); }