title: Can´t make window fade using javascript or add transition effect in css
body: <p>I've been having issues regarding the usage of the <code>fadeOut</code> function in order to add an effect whenever I close the window pop up message. </p>
  
  <p>At the same time, I've tried adding a transition effect to the div in CSS but it didn't work either. My idea was to add this fading effect to the <code>if</code> statement in JavaScript part but that didn't work.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.window {
    position: fixed;
    border-width: 0px;
    top: 0;
    right: 0;
    left: 0;
    bottom: 0;
    margin: auto;
    padding: 0px;
    background: url(images/blue-abstract-noise-free-website-background-image.jpg);
    border-radius: 12px;
    width: 476px;
    height: 276px;
    opacity: 1;
    z-index: 1;
    box-shadow: 2px 1px 2.82px 1.8px rgba(209, 55, 55, 0.486), 0px 3px 5.88px 0.12px rgba(211, 49, 49, 0.514);
  }
  
  .layover {
    background-color: rgba(100, 99, 92, 0.699);
    position: absolute;
    right: 0px;
    top: 0px;
    width: 100%;
    height: 100%;
    border-radius: 12px;
  }
  
  .h2 {
    position: absolute;
    left: 12px;
    font-weight: 900;
    font-size: 20px;
    color: white;
    font-family: sans-serif;
  }
  
  .yesandno {
    height: 80px;
    width: 250px;
    position: absolute;
    top: 200px;
    left: 217px;
  }
  
  .yes {
    display: inline-block;
    position: absolute;
    height: 30px;
    width: 80px;
    margin: 0px;
    left: 100px;
  }
  
  .yes&gt;button {
    display: block;
    cursor: pointer;
    margin: 0px;
    padding: 0px;
    border: 0px;
    border-radius: 8px;
    height: 100%;
    width: 100%;
    color: white;
    font-weight: 900;
    font-size: 13px;
    font-family: sans-serif;
    opacity: 1;
    z-index: 2;
    background-color: rgba(129, 127, 127, 0.808);
  }
  
  .no {
    display: inline-block;
    position: absolute;
    height: 30px;
    width: 80px;
    margin: 0px;
    right: 300px;
  }
  
  .no&gt;button {
    display: block;
    cursor: pointer;
    margin: 0px;
    padding: 0px;
    border: 0px;
    border-radius: 8px;
    height: 100%;
    width: 100%;
    color: white;
    font-weight: 900;
    font-size: 13px;
    font-family: sans-serif;
    opacity: 1;
    z-index: 2;
    background-color: rgba(129, 127, 127, 0.808);
  }
  
  .langmessage {
    position: absolute;
    top: 80px;
    text-align: center;
    font-weight: 900;
    font-size: 13px;
    font-family: sans-serif;
    color: white;
    left: 10px;
    right: 10px;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;body&gt;
    &lt;div class="container"&gt;
      &lt;div class="window" id="win"&gt;
        &lt;div class="layover"&gt;
          &lt;div class="h2"&gt;
            &lt;h2&gt;Oops!&lt;/h2&gt;
          &lt;/div&gt;
          &lt;div class="yesandno"&gt;
            &lt;figure class="yes"&gt;
              &lt;button onclick="window.location.href= 'espanol.html';"&gt;Si&lt;/button&gt;
            &lt;/figure&gt;
            &lt;figure class="no"&gt;
              &lt;button onclick id="buttonn"&gt;No&lt;/button&gt;
            &lt;/figure&gt;
          &lt;/div&gt;
          &lt;div class="langmessage"&gt;
            Hemos detectado que el idioma de su ordenador se encuentra en español. ¿Le gustaría utilizar la versión en español de nuestro sitio web?
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  
    &lt;script type="text/javascript"&gt;
      var lang = navigator.language;
      if ("" + lang == "es-US") {
        var div = document.getElementById("win");
      }
      var button = document.getElementById("buttonn")
      buttonn.onclick = function() {
        var div = document.getElementById("win");
        if (div.style.display !== "none") {
          div.style.display = "none";
  
        }
      }
    &lt;/script&gt;
  
  &lt;/body&gt;</code></pre>
  </div>
  </div>
  </p>