DEV Community

Areeb ur Rub
Areeb ur Rub

Posted on • Edited on

4 1

Popup Message(Modal), in 10 lines of Javascript;

Buy Me A Coffee

So you might have seen popup message on some website, here is a simplest way to make that

So to make this I have created a div with id Modal-1, using position property in css fixed the position at the center and then set the display to none so that it's hidden by default.

I have changed the background and given the modal a frost glass effect.

You can try the frost glass effect, check this out : Frost Glass Effect

Now, using javascript I have added a event listener to both the click button and close button you can initialize the popup in whatever way you want.

To Make the popup visible I changed the elements style display to block this will make the modal visible, to make the close button work again change the style.display to none.

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay