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