<! DOCTYPE html >
< html lang = " zh" >
< head>
< meta charset = " UTF-8" >
< meta name = " viewport" content = " width=device-width, initial-scale=1.0" >
< title> 2025年跨年倒计时</ title>
< style>
body {
font-family : 'Arial' , sans-serif;
background : linear-gradient ( 45deg, #f39c12, #e74c3c, #8e44ad, #3498db) ;
background-size : 400% 400%;
animation : gradientAnimation 15s ease infinite;
margin : 0;
height : 100vh;
display : flex;
flex-direction : column;
justify-content : center;
align-items : center;
color : white;
text-align : center;
overflow : hidden;
}
@keyframes gradientAnimation {
0% { background-position : 0% 50%; }
50% { background-position : 100% 50%; }
100% { background-position : 0% 50%; }
}
.title {
font-size : 2.5em;
font-weight : bold;
margin-bottom : 20px;
text-shadow : 0 0 15px rgba ( 255, 255, 255, 0.7) , 0 0 30px rgba ( 255, 255, 255, 0.7) ;
}
.countdown {
font-size : 4em;
font-weight : bold;
text-shadow : 0 0 15px rgba ( 255, 255, 255, 0.7) , 0 0 30px rgba ( 255, 255, 255, 0.7) ;
margin-bottom : 20px;
letter-spacing : 3px;
}
.message {
font-size : 2.5em;
font-weight : bold;
letter-spacing : 2px;
margin-top : 20px;
}
.happy-new-year {
font-size : 5em;
color : #ff6347;
animation : sparkle 1.5s infinite alternate;
text-shadow : 0 0 10px #ff6347, 0 0 30px #ff6347, 0 0 60px #ff6347;
}
@keyframes sparkle {
0% { color : #ff6347; text-shadow : 0 0 10px #ff6347, 0 0 30px #ff6347, 0 0 60px #ff6347; }
100% { color : #fff; text-shadow : 0 0 10px #fff, 0 0 30px #fff, 0 0 60px #fff; }
}
.btn-fullscreen {
position : absolute;
top : 0;
left : 0;
width : 100%;
height : 100%;
background : rgba ( 0, 0, 0, 0.6) ;
color : white;
font-size : 2em;
font-weight : bold;
border : none;
cursor : pointer;
display : flex;
justify-content : center;
align-items : center;
transition : background 0.3s ease;
}
.btn-fullscreen:hover {
background : rgba ( 0, 0, 0, 0.8) ;
}
</ style>
</ head>
< body>
< button class = " btn-fullscreen" id = " fullscreenButton" >
点击全屏观看倒计时
</ button>
< div class = " title" > 2025年跨年倒计时</ div>
< div>
< div class = " countdown" id = " countdown" > </ div>
< div class = " message" id = " message" > </ div>
< div class = " happy-new-year" id = " happyNewYear" > 🎉🎆🎇</ div>
</ div>
< script>
const targetDate = new Date ( '2025-01-01T00:00:00' ) . getTime ( ) ;
function updateCountdown ( ) {
const now = new Date ( ) . getTime ( ) ;
const distance = targetDate - now;
const days = Math. floor ( distance / ( 1000 * 60 * 60 * 24 ) ) ;
const hours = Math. floor ( ( distance % ( 1000 * 60 * 60 * 24 ) ) / ( 1000 * 60 * 60 ) ) ;
const minutes = Math. floor ( ( distance % ( 1000 * 60 * 60 ) ) / ( 1000 * 60 ) ) ;
const seconds = Math. floor ( ( distance % ( 1000 * 60 ) ) / 1000 ) ;
document. getElementById ( 'countdown' ) . innerHTML = ` ${ days} 天 ${ hours} 小时 ${ minutes} 分 ${ seconds} 秒 ` ;
if ( distance < 0 ) {
document. getElementById ( 'countdown' ) . innerHTML = "新年快乐!" ;
document. getElementById ( 'message' ) . innerHTML = "2025年到啦!" ;
document. getElementById ( 'happyNewYear' ) . innerHTML = "🎉🎆🎇" ;
}
}
setInterval ( updateCountdown, 1000 ) ;
const fullscreenButton = document. getElementById ( 'fullscreenButton' ) ;
fullscreenButton. addEventListener ( 'click' , ( ) => {
if ( document. documentElement. requestFullscreen) {
document. documentElement. requestFullscreen ( ) ;
} else if ( document. documentElement. mozRequestFullScreen) {
document. documentElement. mozRequestFullScreen ( ) ;
} else if ( document. documentElement. webkitRequestFullscreen) {
document. documentElement. webkitRequestFullscreen ( ) ;
} else if ( document. documentElement. msRequestFullscreen) {
document. documentElement. msRequestFullscreen ( ) ;
}
fullscreenButton. style. display = 'none' ;
} ) ;
</ script>
</ body>
</ html>