Показать сообщение отдельно
  #4 (permalink)  
Старый 13.01.2016, 16:12
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,075

alex72bel,
а почитать самому доку?
https://learn.javascript.ru/cookie
window.addEventListener("DOMContentLoaded", function() {
     var d = document.querySelector("#parent_popup"),
         e = document.querySelector(".close");
     e.addEventListener("click", function(a) {
         a.preventDefault();
         d.classList.toggle("show");
     })
     function getCookie(name) {
    var matches = document.cookie.match(new RegExp(
    "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)"
  ));
  return matches ? decodeURIComponent(matches[1]) : undefined;
}
!getCookie('rem')  &&  window.setTimeout(function() {
     var date = new Date(new Date().getTime() + 7 * 24 * 60 * 60 * 1000);
     document.cookie = "rem=yes; path=/; expires=" + date.toUTCString();
     d.classList.toggle("show");
     window.setTimeout(function() {
     d.classList.contains("show") && d.classList.toggle("show")
},5000) //open
},5000) //pause
 });
Ответить с цитированием