{"size": 1120, "ext": "js", "max_stars_repo_path": "build/js/main.js", "max_stars_repo_name": "boguz/burgton-button-docs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "build/js/main.js", "max_issues_repo_name": "boguz/burgton-button-docs", "max_issues_repo_issues_event_min_datetime": "2021-06-17T00:43:53.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-20T21:51:51.000Z", "max_forks_repo_path": "build/js/main.js", "max_forks_repo_name": "boguz/burgton-button-docs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 3, "max_forks_count": null, "avg_line_length": 32.9411764706, "max_line_length": 90, "alphanum_fraction": 0.7348214286}
// Get Elements
const navElements = document.querySelectorAll('.nav__link');
const burgton = document.querySelector('.topbar__button');

// handle click on the menu items
const handleNavClick = (event) => {
  event.preventDefault();

  if (!event.target.classList.contains('nav__link--active')) {
    toggleNavClass(event.target);
    scrollToSection(event.target.getAttribute('href'));
    burgton.deactivate();
  }
};

// Toggle the navigation active class
const toggleNavClass = (target) => {
  const activeLink = document.querySelector('.nav__link--active');
  activeLink && activeLink.classList.remove('nav__link--active');
  target.classList.add('nav__link--active');
};

// Smooth scroll to the correct section,
// accounting for the topbar height
const scrollToSection = (sectionID) => {
  const section = document.querySelector(sectionID);
  const y = section.getBoundingClientRect().top + window.pageYOffset - 96;
  window.scrollTo({top: y, behavior: 'smooth'});
};

// Event Listeners
navElements.forEach((navElement) => navElement.addEventListener('click', handleNavClick));
//# sourceMappingURL=main.js.map
