2

I have a problem with classList.

I tried to Open/Close with one button, like a Element.classList.toggle("name_css");

I have problems with that in IE 11/Edge.
Other browsers are OK.

var buttonOpen = document.querySelector(".travel__btn");
var ModalWindow = document.querySelector("form");
ModalWindow.classList.add("info__modal-hide");
buttonOpen.addEventListener("click", function(evt) {
  evt.preventDefault();
  ModalWindow.classList.toggle("info__modal");
  Login.focus();
  if (storage) {
    In.value = storage;
    Out.focus();
  } else {
    In.focus();
  }
});

.travel__info {
  padding: 55 px;
  height: 285 px;
  width: 458 px;
  background - color: white;
  display: block;
}
.info__modal - hide {
    display: none;
  }
  .info__modal {
    display: block;
    animation: bounce 0.6 s;
  }
Nope
  • 21,584
  • 7
  • 42
  • 72
  • 4
    Both IE11 and Edge should support that use of `classList.toggle` (IE10 and earlier wouldn't; IE11 wouldn't if you used the second argument). Please update your question with a [mcve] demonstrating the problem, using Stack Snippets (the `[<>]` toolbar button) to make it **runnable**. – T.J. Crowder Sep 05 '17 at 14:16
  • 1
    I'd also suggest ensuring that IE11 isn't hobbling itself by running in (in)Compatibility Mode. More: https://stackoverflow.com/questions/32648564/how-to-prevent-ie-from-opening-my-page-in-compatibility-mode and https://stackoverflow.com/a/13305862/157247 – T.J. Crowder Sep 05 '17 at 14:19
  • `.info__modal - hide` I hope this is a typo. – Dzulqarnain Nasir Feb 06 '18 at 07:59

0 Answers0