/* global document */

import ready from 'Utils/documentReady.js';

ready(function(){

  var burgers = document.querySelectorAll('.burger');

  for (var i = 0; i < burgers.length; i++) {
    var burger = burgers[i];
    burger.addEventListener('click', showBurgerTarget);
  }

  function showBurgerTarget() {
    const body = document.querySelector('body');
    var targetId = this.getAttribute('data-target-id');
    var targetClassToggle = this.getAttribute('data-target-class-toggle');

    if (targetId && targetClassToggle) {
      this.classList.toggle('burger--close');
      document.getElementById(targetId).classList.toggle(targetClassToggle);
      body.classList.toggle('of-h');
      body.classList.toggle('mob-menu-active');
      // document.querySelector('.black-background').classList.toggle('active');
    }
  }

});
