@kentos

Как реализовать такой скрипт?

Здравствуйте, может кто подскажет как сделать такие уведомления как на клац Может кто видел на сторонних ресурсах

Писал сам --
const letStartAlert = document.createElement('div');
letStartAlert.className = 'notif';
document.body.appendChild(letStartAlert);


function showNotification(options) {
  var notification = document.createElement("div");

  notification.className = "notification";
  if (options.cssText) {
    notification.style.cssText = options.cssText;
  }
  notification.style.top = options.top || 0;
  notification.style.right = options.right || 0;
  notification.style.bottom = (options.bottom || 0) + "px";
  notification.style.left = (options.left || 0) + "px";
  if (options.className) {
    notification.classList.add(options.className);
  }


  notification.innerHTML =
    '<p class="text_inner">' +
    '<span class="bg_notif">' +
    options.counter +
    "пользователей " +
    "</span>" +
    options.text +
    "</p>"  + 'проверено Proofly';
    document.body.appendChild(notification);

  setTimeout(function() {
    document.body.removeChild(notification);
  }, 4000);
}

var i = 1;

setInterval(function() {
  showNotification({
    top: "auto",
    right: "auto",
    left: "24",
    bottom: "24",
    counter: "2 ",
    text: " просматривают эту страницу",
    className: "innerNotification",
    cssText: "1323"
  });
}, 6000);


За говнокод не ругайте, что можно поправить? и как сделать чтобы уведомления друг под другом появлялись и стилезовать
  • Вопрос задан
  • 82 просмотра
Пригласить эксперта
Ответы на вопрос 1
bootd
@bootd
Гугли и ты откроешь врата знаний!
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы