Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/scripts/main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,27 @@
'use strict';

const pushNotification = (posTop, posRight, title, description, type) => {
// write code here
const notification = document.createElement('div');

notification.className = `notification ${type}`;
notification.style.top = `${posTop}px`;
notification.style.right = `${posRight}px`;

const titleElement = document.createElement('h3');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task requires the title element to be an h2 with class title (prefer h2 element). Currently using h3 without the title class


titleElement.textContent = title;
notification.appendChild(titleElement);

const descriptionElement = document.createElement('p');

descriptionElement.textContent = description;
notification.appendChild(descriptionElement);

document.body.appendChild(notification);

setTimeout(() => {
notification.remove();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task explicitly states: 'Important: Do not remove elements from the DOM in this task; instead, use style attributes just to hide messages visually'. Use notification.style.display = 'none' instead of notification.remove()

}, 2000);
};

pushNotification(
Expand Down
Loading