Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

notification-page

@iamcelestino

Desktop design screenshot for the Notifications page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
2junior
View challenge

Design comparison


SolutionDesign

Solution retrospective


any suggestions on how to improve are welcome, Please SHARE.

Community feedback

P
Jeuri Morel 1,405

@JeuriMorel

Posted

Clicking on a notification makes the counter go up indefinitely but I'm pretty sure that the counter is supposed to represent the number of unread notifications. So it should start with how many of the notifications are in the unread state and decrease by one whenever those notifications are marked as read.

0

@iamcelestino

Posted

Thanks a lot.

I made all the change you suggested. but I the didn't get success, stopping the counter.

can you give an Idea?

how did you see the way I wrote my JS code is that the good way, is the room for improvements apart from the one you mentioned?

@JeuriMorel

0
P
Jeuri Morel 1,405

@JeuriMorel

Posted

@iamcelestino

I took a look at your JS and it looks like you're always decreasing count every time the notification is clicked. I would add an if statement to run the code only if the notification is unread. I would rearrange your event listener function to look more like this:

notifications.forEach(notification => {
    notification.addEventListener("click", () => {
        const marker = notification.childNodes[3].childNodes[1].firstChild.nextSibling.childNodes[2];
        if (marker.classList.contains("marker")) {
            count--;
            countReadNotification(count);
            notification.classList.add("change__color");
            marker.classList.remove("marker");
        }
    })
});
0

@iamcelestino

Posted

THANKS A LOT. @JeuriMorel

0
P
Jeuri Morel 1,405

@JeuriMorel

Posted

@iamcelestino You're welcome. :)

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord