function getScrollBarWidth(){ if($(document).height() > $(window).height()){ $('body').append('
'); fakeScrollBar = $('#fakescrollbar'); fakeScrollBar.append('
'); var w1 = fakeScrollBar.find('div').innerWidth(); fakeScrollBar.css('overflow-y', 'scroll'); var w2 = $('#fakescrollbar').find('div').html('html is required to init new width.').innerWidth(); fakeScrollBar.remove(); return (w1-w2); } return 0; } function getWindowWidth () { return $(window).outerWidth() + getScrollBarWidth() ; } function getWindowHeight () { return $(window).height() ; } $.exists = function(selector) { return ($(selector).length > 0); } function getScrollTop () { return $(window).scrollTop(); } /* Fixed Object */ function objectFixed ( object, fixedStartTop, className ) { if ( getScrollTop() > fixedStartTop ) { if (!($(object).hasClass(className))) { $(object).addClass(className); } }else { if ($(object).hasClass(className)) { $(object).removeClass(className); } } } $(document).ready(function () { if ($.exists('#header')) { $(window).scroll(function () { //if ( getWindowWidth () < (960-1) ) { objectFixed($("#header"), 0, "top-fixed"); //} }); $(window).resize(function () { //if ( getWindowWidth () > 960 ) { //$("#header").removeClass("top-fixed"); //} }); } if ($.exists('#subVisual')) { $("#header").addClass("sub-header"); } if ($.exists("#rightBar")) { var $quickBtnWrap = $('.quick-menu-wrap'); var $quickBtn = $('.quick-menu-btn'); $quickBtn.mouseenter(function () { $quickBtnWrap.addClass('on'); }); $quickBtnWrap.mouseleave(function () { $quickBtnWrap.removeClass('on'); }); var $recordBtnWrap = $(".record-btn-wrap"); var $recordBtn = $(".record-btn"); $recordBtn.on("mouseenter focus", function () { $recordBtnWrap.addClass('on'); }); $recordBtnWrap.on("mouseleave focusout",function () { $recordBtnWrap.removeClass('on'); }); } if ($.exists(".project-faq")) { $('.project-qna-list').slick({ slidesToShow: 5, slidesToScroll: 5, vertical: true, arrows: false, fade: false, dots:true, autoplay: false, speed:0, infinite:false, autoplaySpeed: 4000, pauseOnHover:false, swipe: false, zIndex:1, }); } if ($.exists(".comment-item")) { var $commentItem = $(".comment-item"); $commentItem.each(function () { var $commentBtn = $(this).find('.reply-show'); var $commentWriteBtn = $(this).find('.reply-write-btn'); $(this).addClass("open"); $(this).siblings('.comment-reply').fadeIn(300); $commentBtn.click(function () { var $comment = $(this).parents('.comment-item'); if ($comment.hasClass('open')) { $comment.siblings('.comment-reply').hide(); $comment.removeClass('open'); }else { $comment.siblings('.comment-reply').fadeIn(300); $comment.addClass('open'); } }) $commentWriteBtn.click(function () { var $comment = $(this).parents('.comment-item'); if ($comment.hasClass('open')) { $comment.siblings('.comment-reply').hide(); $comment.removeClass('open'); }else { $comment.siblings('.comment-reply').fadeIn(300); $comment.addClass('open'); } }) }) } });