$(function(){ projectJs(); scrollJs(); stickyJs(); }); $(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'); }); function scrollJs(){ $('body').niceScroll({ cursorcolor: "rgba(0,0,0,0.6)", cursorwidth: 5, scrollspeed: 70, cursorborderradius: 0, mousescrollstep: 60, cursoropacitymin: 0, cursoropacitymax: 1, background: "rgba(0,0,0,0.2)", cursorborder: "none", autohidemode: false, boxzoom: false, smoothscroll: true, zindex:1001, }); $('.project_view .project_info_g').niceScroll({ cursorcolor: "rgba(0,0,0,0.6)", cursorwidth: 5, scrollspeed: 70, cursorborderradius: 0, mousescrollstep: 60, cursoropacitymin: 0, cursoropacitymax: 1, background: "rgba(0,0,0,0.2)", cursorborder: "none", autohidemode: false, boxzoom: false, smoothscroll: true, zindex:1001, }); } function stickyJs() { //모바일구분 $(window).resize(function(){ windowWidth = $(window).width(); if(windowWidth > 1279){ $("#sticker").sticky({topSpacing:0}); }else{ $("#sticker").unstick(); } }).resize(); $(document).ready(function(){ $('.board_info_g').css('width',$('#sticker-sticky-wrapper').width()); }); } function projectJs() { if(!$('#main').is('.m11')) return; $(".project_wrap .project_list .list").mouseenter(function(){ var textHeight= $(this).find(".text_g").height(); $(".project_wrap .project_list .text_g").css("height",textHeight+"px"); $(".project_wrap .project_list .text_g").css("opacity",1); }); $(".project_wrap .project_list .list").mouseleave (function(){ $(".project_wrap .project_list .text_g").css("height","auto"); $(".project_wrap .project_list .text_g").css("opacity",0); }); }