分享一个2014年圣诞节倒计时页面特效
网站建设 2023-01-28 21:39www.1681989.com免费网站
2014年的圣诞节即将来临之季。长沙网络推广给大家分享一款2014年圣诞节倒计时网页,当天的日期卡片有抖动的效果。一起看下效果图
实现的代码。
html代码
复制代码
代码如下:<h1>
Merry Christmas</h1>
<ul>
<li>
<div class="door">
1</div>
</li>
<li>
<div class="door">
2</div>
</li>
<li>
<div class="door">
3</div>
</li>
<li>
<div class="door">
4</div>
</li>
<li>
<div class="door">
5</div>
</li>
<li>
<div class="door">
6</div>
</li>
<li>
<div class="door">
7</div>
</li>
<li>
<div class="door">
8</div>
</li>
<li>
<div class="door">
9</div>
</li>
<li>
<div class="door">
10</div>
</li>
<li>
<div class="door">
11</div>
</li>
<li>
<div class="door">
12</div>
</li>
<li>
<div class="door">
13</div>
</li>
<li>
<div class="door">
14</div>
</li>
<li>
<div class="door">
15</div>
</li>
<li>
<div class="door">
16</div>
</li>
<li>
<div class="door">
17</div>
</li>
<li>
<div class="door">
18</div>
</li>
<li>
<div class="door">
19</div>
</li>
<li>
<div class="door">
20</div>
</li>
<li>
<div class="door">
21</div>
</li>
<li>
<div class="door">
22</div>
</li>
<li>
<div class="door">
23</div>
</li>
<li>
<div class="door">
24</div>
</li>
<li>
<div class="door">
25</div>
</li>
</ul>
<p id="message">
</p>
css代码
复制代码
代码如下:body {
background: url("xmas.jpg");
color: #fff;
font-family: 'Oleo Script', cursive;
paddg: 20px;
font-weight: 400;
}
h1 {
marg:0;
font-size:75px;
le-height: 75px;
text-align: center;
font-weight: 400;
}
ul {
marg:0 auto 30px auto;
paddg:0;
list-style-type:none;
max-width:900px;
width: 100%;
text-align: center;
user-select: none;
}
li {
font-weight: 400;
background-color: #fff;
box-sizg: border-box;
border-radius: 6px;
display: le-block;
color:#111;
cursor:poter;
font-size: 26px;
paddg:15px;
marg:25px 12px;
width: 130px;
height:130px;
le-height: 100px;
text-align:center;
position: relative;
vertical-align:;
user-select: none;
perspective: 800px;
transition: all 0.4s ease--out;
}
ul li:last-child {
background-size:cover;
display:block;
clear:both;
marg: 20px auto 0 auto;
width: 200px;
height: 275px;
}
ul li:last-child .door {
font-size: 100px;
width: 200px;
height: 275px;
le-height: 240px;
}
ul li:last-child .revealed {
le-height: 123px;
}
.door {
user-select: none;
color:#fff;
font-size: 70px;
position: absolute;
:0;
left:0;
background-color: #91c1;
box-sizg: border-box;
border-: 2px #eee dashed;
border-right: 2px #eee dashed;
border-bottom: 2px #eee dashed;
border-left: 1px #eee solid;
border-radius: 6px;
paddg:15px;
width: 130px;
height:130px;
transform-orig: 0 40%;
transition: all 0.4s ease--out;
transform-style: preserve-3d;
}
.current .door {
background-color: #7EAD44;
}
.current .door.open{
color: #7EAD44;
}
.revealed {
user-select: none;
}
#message {
box-sizg: border-box;
color: #222;
display: none;
font-size: 24px;
paddg: 20px;
background: #eddecb;
max-width: 500px;
width: 100%;
border-radius: 15px;
marg: 0 auto;
}
.open {
box-shadow: 14px 0px 15px -1px rgba(0,0,0,0.2);
color: #91c1;
transform: rotate3d(0, 1, 0, -98deg);
}
.jiggle {
animation: jiggle 0.2s fite;
transform: rotate(-1deg);
}
@keyframes jiggle {
0% {
transform: rotate(-1deg);
}
50% {
transform: rotate(1deg);
}
}
@media screen and (m-width: 480px) {
li {
marg:25px 20px;
}
}</p> <p>@media screen and (m-width: 768px) {
body {
background-size:150px;
}
p {
right: 6%;
: 20%;
bottom: auto;
marg-left: auto;
left: auto;
}
}
js代码
复制代码
代码如下:$(document).ready(function () {
var words = [
'Lorem ',
'ipsum ',
'delor',
'sit',
'amet',
'consect',
'adipisci',
'elit,',
'sed.',
'Eiusmod',
'tempor',
'a',
'enim',
'mim',
'season',
'nulla',
'dolore',
'st',
'id',
'est',
'laboris',
'ut.',
'aute',
'laborum',
'toe'
];
var message = '';
var date = new Date();
var day = date.getDate();
var month = date.getMonth() + 1;
var scrolled = false;
var timeDelay = 200;
var cardReveal = function () {
$('#message').text(message).show();
};
if (month === 12) {
$('li').each(function (dex) {
var adventwdow = dex + 1;
var item = $(this);
if (day !== adventwdow && adventwdow < day) {
wdow.setTimeout(function () {
item.children('.door').addClass('open');
}, timeDelay);
}
timeDelay += 100;
if (adventwdow <= day) {
var word = words[dex];
$(this).append('<div class="revealed">' + word + '</div>');
message = message + ' ' + word;
}
if (adventwdow === day) {
$(this).addClass('current');
$(this).addClass('jiggle');
}
$(this).on('click', function () {
if (adventwdow <= day) {
$(this).children('.door').toggleClass('open');
}
$(this).removeClass('jiggle');
if (day >= 25 && adventwdow === 25) {
messageReveal();
if (!scrolled) {
$('html, body').animate({ scrollTop: $('#message').offset(). }, 2000);
scrolled = true;
}
}
});
});
if (day >= 26) {
messageReveal();
}
}
});
网站设计
- 静宁会SEO的网站建设公司:全面提升您的网络影
- 提升在线业务的关键:选择最佳的丽水网站建设
- 浙江网站优化发展潜力如何
- 井研专业的网站建设公司:打造您的在线品牌
- 灵山SEO网站建设公司:提升您的在线业务表现
- 蒙城网站建设优化公司:提升您网站表现的理想
- 阳谷企业网站优化:提升线上业务力的关键
- 樟树专业的网站建设公司:打造您在线业务的坚
- 通河百度SEO排名的策略与技巧
- 重庆百度快照排名如何进行精准的客户引流
- 重庆百度快照排名
- 常宁便宜的建站公司:助您轻松打造在线业务
- 巫溪百度网站优化:提升网站曝光率与流量的关
- 湖北整站优化怎么做才能放大客户需求
- 闸北网站建设多少钱?全面解析与预算规划
- 辽宁企业网站优化怎么做电话营销