婚礼倒计时怎么设置,婚礼倒计时如何设置?
王富贵
- 管理员
- 注册排名5
- 经验值538750
- 级别管理员
- 主题107750
- 回复0
楼主
<style>
body {
font-family: Arial, sans-serif;
background-color: #f5f5f5;
margin: 0 auto;
max-width: 1200px;
padding: 40px;
text-align: center;
}
h1 {
font-size: 36px;
color: #fff;
margin-bottom: 20px;
}
li {
list-style-type: decimal;
margin-bottom: 20px;
}
li h2 {
font-size: 24px;
color: #ffcc99;
margin-bottom: 10px;
}
li p {
font-size: 18px;
color: #666;
line-height: 1.5;
margin-bottom: 10px;
}
li img {
max-width: 100%;
height: auto;
border-radius: 10px;
}
</style>
Wedding Countdown
<div class="container">
<div id="countdown"></div>
</div>
<script>
function countdown() {
var count = new Date().getTime();
var days = Math.floor(count / (1000 * 60 * 60 * 24));
var hours = Math.floor((count % (1000 * 60 * 60 * 24)) / (1000 * 60));
var minutes = Math.floor(((count % (1000 * 60 * 60)) % (1000 * 60)) / (1000 * 60) * 60));
var seconds = Math.floor(((count % (1000 * 60 * 60)) % (1000 * 60)) % (1000 * 60)) / (1000 * 60));
document.getElementById("countdown").innerHTML = "婚礼倒计时: " + days + "/" + hours + ":" + minutes + ":" + seconds;
if (days < 7 && hours < 4 && minutes < 1) {
document.getElementById("countdown").innerHTML += "<span style='color:red'>End of Day</span>";
} else if (days >= 7 && hours >= 4 && minutes >= 1) {
document.getElementById("countdown").innerHTML += "<span style='color:green'>Halfway Through Day</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 4) {
document.getElementById("countdown").innerHTML += "<span style='color:orange'>Afternoon Break</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 5) {
document.getElementById("countdown").innerHTML += "<span style='color:brown'>Morning Dinner</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 6) {
document.getElementById("countdown").innerHTML += "<span style='color:pink'>Evening Dinner</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 7) {
document.getElementById("countdown").innerHTML += "<span style='color:yellow'>End of Night</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 8) {
document.getElementById("countdown").innerHTML += "<span style='color:purple'>Milestone Party</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 9) {
document.getElementById("countdown").innerHTML += "<span style='color:gray'>Silent Auction</span>";
} else if (days >= 7 && hours >= 4 && minutes <= 1 && hours >= 10) {
document.getElementById("countdown").innerHTML += "<span style='color:green'>End of the Day</span>";
}
}
countdown();
</script>