對于我的專案,我試圖讓它在顯示 3 秒后清除頁面,然后在清除后顯示新的內容。這是我的代碼:
<style media="screen">
body {
background-color: black;
}
p {
color: white;
font-family: "Courier";
font-size: 20px;
margin: 300px 0 0 250px;
white-space: nowrap;
overflow: hidden;
width: 30em;
animation: type 4s steps(60, end);
}
@keyframes type{
from { width: 0; }
}
</style>
</head>
<body>
<p>Welcome...</p>
<!--- I want the page to clear here, to display the second paragraph --->
<p>Are you ready to pass the gates?</p>
我嘗試了很多替代方案,但沒有任何效果。
我希望我說清楚了,希望你能幫助我。
uj5u.com熱心網友回復:
setTimeout(
function() {
document.getElementById('one').style.display='none';
document.getElementById('two').style.display='block';
}, 3000);
#two{
display:none;}
<p id = 'one'>Welcome!</p>
<p id = 'two'>goodBy</p>
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/411145.html
標籤:
