(function($) {
	"use strict";
	var fullHeight = function() {
		$('.js-fullheight').css('height', $(window).height());
		$(window).resize(function(){
			$('.js-fullheight').css('height', $(window).height());
		});
	};
	fullHeight();
	$('.sidebarCollapse').on('click', function () {
      $('.sidebar').toggleClass('active');
  });
  let mainNavLinks = document.querySelectorAll("nav ul li a");
  let mainSections = document.querySelectorAll("main section");  
  let lastId;
  let cur = [];  
  window.addEventListener("scroll", event => {
	let fromTop = window.scrollY;
  
	mainNavLinks.forEach(link => {
	  let section = document.querySelector(link.hash);
  
	  if (
		section.offsetTop <= fromTop &&
		section.offsetTop + section.offsetHeight > fromTop
	  ) {
		link.classList.add("current");
	  } else {
		link.classList.remove("current");
	  }
	});
  });
})(jQuery);
