/* ¼­ºê¸Þ´º ½ºÅ©·Ñ */ (function (global, $) { var $menu = $('.m-s'), $contents = $('.scroll'), $doc = $('html, body'); $(function () { $menu.on('click', 'a', function (e) { var $target = $(this).parent(), idx = $target.index(), section = $contents.eq(idx), offsetTop = section.offset().top +5; $doc.stop(). animate({ scrollTop: offsetTop }, 500); return false; }); }); $(window).scroll(function () { var scltop = $(window).scrollTop(); $.each($contents, function (idx, item) { var $target = $contents.eq(idx), i = $target.index(), targetTop = $target.offset().top; if (targetTop <= scltop) { $menu.removeClass('on'); $menu.eq(idx).addClass('on'); } if (!(200 <= scltop)) { $menu.removeClass('on'); } }); }); })(window, window.jQuery);