如何轻松关闭弹出窗口?
How to close a popup with ease?
我仍在学习 JavaScript,我正在给自己做一些练习。我创建了一个像 div 这样的小弹出窗口(因为不确定如何创建一个实际的弹出窗口)并且它工作正常。但是,我不知道如何通过过渡缓慢关闭 div,但它会立即关闭。
The code is located below:
这是来自 w3schools 的代码,但这是您想要的。 W3schools 是一个适合初学者的好网站,因此请查看 javascript 和 jquery 教程
<!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>
我仍在学习 JavaScript,我正在给自己做一些练习。我创建了一个像 div 这样的小弹出窗口(因为不确定如何创建一个实际的弹出窗口)并且它工作正常。但是,我不知道如何通过过渡缓慢关闭 div,但它会立即关闭。
The code is located below:
这是来自 w3schools 的代码,但这是您想要的。 W3schools 是一个适合初学者的好网站,因此请查看 javascript 和 jquery 教程
<!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>