// ÇöÀç ½ºÅ©·Ñ¹ÙÀÇ À§Ä¡¸¦ ÀúÀåÇÏ´Â º¯¼ö (px) var currentScrollTop = 0; // ºñµ¿±â½Ä jQueryÀ̹ǷΠwindow load ÈÄ jQuery¸¦ ½ÇÇàÇØ¾ß ÇÔ window.onload = function() { // »õ·Î°íħ ÇßÀ» °æ¿ì¸¦ ´ëºñÇÑ ¸Þ¼Òµå ½ÇÇà scrollController(); // ½ºÅ©·ÑÀ» ÇÏ´Â °æ¿ì¿¡¸¸ ½ÇÇàµÊ $(window).on('scroll', function() { scrollController(); }); } // ¸ÞÀÎ ¸Þ´ºÀÇ À§Ä¡¸¦ Á¦¾îÇÏ´Â ÇÔ¼ö function scrollController() { currentScrollTop = $(window).scrollTop(); if (currentScrollTop < 1) { // ¼ýÀÚ¸¦ ¹Ù²Ù¾î ³ôÀÌÁ¶Àý $('#blog-header-container').css('top', -(currentScrollTop)); $('.container-wrap').css('top', 0-(currentScrollTop)); // ¼ýÀÚ¸¦ ¹Ù²Ù¾î ³ôÀÌÁ¶Àý if ($('.container-wrap').hasClass('fixed')) { $('.container-wrap').removeClass('fixed'); $('.container-wrap .menu-icon').removeClass('on'); } } else { if (!$('.container-wrap').hasClass('fixed')) { $('#blog-header-container').css('top', -0); // ¼ýÀÚ¸¦ ¹Ù²Ù¾î ³ôÀÌÁ¶Àý $('.container-wrap').css('top', 0); $('.container-wrap').addClass('fixed'); $('.container-wrap .menu-icon').addClass('on'); } } }