Goran Sovilj
Goran Sovilj

Reputation: 77

How to close a popup with ease?

I'm still learning JavaScript and i am giving myself a few exercises. I have created a small popup like div (since not sure how to create an actual popup) and it works fine. However, i can't figure out how to close the div slowly with transition, but it closes instantly.

The code is located below: 

https://jsfiddle.net/wabb5x8e/2/

Upvotes: 0

Views: 193

Answers (1)

Gerasimos Ragavanis
Gerasimos Ragavanis

Reputation: 361

This is code from w3schools but this is what you want. W3schools is a great site for beginners so check javascript and jquery tutorial

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
    $("button").click(function(){
        $("p").hide(1000);
    });
});
</script>
</head>
<body>

<button>Hide</button>

<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>

</body>
</html>

Upvotes: 1

Related Questions