$(function() {
var onScroll;
onScroll = function(e) {
var $nav_items, active_cls, scrollPos;
scrollPos = $(document).scrollTop() + 91;
$nav_items = $('.menu-box').find('.link');
active_cls = '-active';
return $nav_items.each(function() {
var $refElement, refElement_height;
$refElement = $($(this).attr('href'));
refElement_height = $refElement.height() + parseInt($refElement.css('paddingBottom')) + parseInt($refElement.css('paddingTop'));
if ($refElement.length) {
if ($refElement.offset().top <= scrollPos && $refElement.offset().top + refElement_height > scrollPos) {
$nav_items.removeClass(active_cls);
return $(this).addClass(active_cls);
} else {
return $(this).removeClass(active_cls);
}
}
});
};