$(function(){ /* 부드러운 스크롤; */ $("html").easeScroll({ frameRate: 60, animationTime: 1100, stepSize: 80, pulseAlgorithm: !0, pulseScale: 7, pulseNormalize: 1, accelerationDelta: 40, accelerationMax: 1, keyboardSupport: !0, arrowScroll: 50 }); /*subtab*/ $(".sub_tab button.tab").click(function(){ $(this).toggleClass("on"); $(".sub_tab .inner>div>ul").stop().slideUp(300); $(this).next().stop().slideToggle(300); $(this).parent().siblings().find("button").removeClass("on"); }); $(window).scroll(function(){ var scrollValue = $(window).scrollTop(); //console.log(scrollValue); if(scrollValue >=10){ $("#header").addClass("wh"); }else if(scrollValue < 10){ $("#header").removeClass("wh"); } }); m52(); function m52(){ if(!$("#main").is(".m52")) return; $("#selectEmail").change(function() { var selectedValue = $(this).val(); var emailInput = $("#f_email2"); if (selectedValue !== "1") { emailInput.val(selectedValue); } else { emailInput.val(""); // Clear the input box if 직접입력 is selected emailInput.focus(); // Move focus to the input box to start blinking cursor } }); $("#selectEmail2").change(function() { var selectedValue = $(this).val(); var emailInput = $("#f_email2"); if (selectedValue !== "1") { emailInput.val(selectedValue); } else { emailInput.val(""); // Clear the input box if 직접입력 is selected emailInput.focus(); // Move focus to the input box to start blinking cursor } }); $("#f_file").on('change',function(){ var fileName = $("#f_file").val(); $(".upload-name").val(fileName); }); } $("#footer .dim").on("click", function(){ $("#footer .dim").fadeOut(300); $("#footer .pop").fadeOut(300); }); $("#footer .p_close").on("click", function(){ $("#footer .dim").fadeOut(300); $("#footer .pop").fadeOut(300); }); $("#footer .foot ul li").on("click",function(){ var fnum = $(this).data("foot"); //console.log(fnum); $("#footer .pop").fadeIn(300); $("#footer .dim").fadeIn(300); $.ajax({ type : "POST" //"POST", "GET" , async : true //true, false , url : "/f_pop.php" , dataType : "html" //전송받을 데이터의 타입 , data: { data_num: fnum} , timeout : 3000 //제한시간 지정 , cache : false //true, false , contentType: "application/x-www-form-urlencoded; charset=UTF-8" , error : function(request, status, error) { //통신 에러 발생시 처리 } , success : function(response, status, request) { //통신 성공시 처리 if(true){ //console.log(response); $("#footer .pop .conwrap").html(response); }else{ } } , beforeSend: function() { //통신을 시작할때 처리 } , complete: function() { //통신이 완료된 후 처리 } }); }); /* scroll */ var $animation_elements = $('.ani'); 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'); });