123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- <template>
- <div class="christmas" v-if="isOpen">
- <div class="christmas-modal">
- <div class="newYear-info">
- <a href="javascript:void(0)" @click="isOpen = false"></a>
- <div class="newYear-img">
- <img src="/images/newYear/chinese-knot.png" :class="{'active': timer > 3}">
- <img src="/images/newYear/happy-new-year.png" :class="{'occur': timer > 3}">
- <img src="/images/newYear/snow.png" :class="{'snow': timer > 8}">
- </div>
- </div>
- </div>
- </div>
- </template>
- <script>
- export default {
- name: 'NewYear',
- data () {
- return {
- isOpen: false,
- timer: 0
- }
- },
- created () {
- setInterval(() => {
- this.timer += 0.5
- }, 500)
- },
- mounted () {
- const endTime = window.localStorage.getItem('newYearEndTime2018')
- const overTime = new Date('2018/02/24 23:59:59').getTime()
- const now = new Date().getTime()
- if (now <= overTime) {
- if (endTime) {
- if (now - endTime >= 1000 * 60 * 60 * 2) {
- this.isOpen = true
- window.localStorage.setItem('newYearEndTime2018', now)
- } else {
- this.isOpen = false
- }
- } else {
- this.isOpen = true
- window.localStorage.setItem('newYearEndTime2018', now)
- }
- } else {
- this.isOpen = false
- }
- }
- }
- </script>
- <style scoped>
- .christmas{
- position:fixed;
- top:0px;
- left:0;
- z-index:10000;
- width:100%;
- height:100%;
- }
- .christmas-modal{
- background:rgba(0,0,0,.6);
- width:100%;
- height:100%;
- }
- .newYear-info{
- position:absolute;
- top:50%;
- left:50%;
- transform: translate(-50%, -50%);
- }
- .newYear-info .newYear-img{
- position:relative;
- }
- .newYear-info .newYear-img img{
- position:absolute;
- top:50%;
- left:50%;
- transform: translate(-50%, -50%);
- }
- .newYear-info .newYear-img img:nth-child(1){
- animation: newYear1 3s linear;
- -o-animation: newYear1 3s linear;
- -webkit-animation: newYear1 3s linear;
- -moz-animation: newYear1 3s linear;
- }
- /*.newYear-info .newYear-img img.active {
- animation: newYear1-active 3s linear infinite;
- -o-animation: newYear1-active 3s linear infinite;
- -webkit-animation: newYear1-active 3s linear infinite;
- -moz-animation: newYear1-active 3s linear infinite;
- }*/
- .newYear-info .newYear-img img:nth-child(2){
- top: -159px;
- left: 10px;
- animation: newYear2 3s linear;
- -moz-animation: newYear2 3s linear;
- -o-animation: newYear2 3s linear;
- -webkit-animation: newYear2 3s linear;
- }
- /* .newYear-info .newYear-img img.occur{
- top: -224px;
- left: -130px;
- animation: newYear2-occur 3s linear infinite;
- -moz-animation: newYear2-occur 3s linear infinite;
- -o-animation: newYear2-occur 3s linear infinite;
- -webkit-animation: newYear2-occur 3s linear infinite;
- }*/
- .newYear-info .newYear-img img:nth-child(3){
- /*left: -15px;
- top: -5px;*/
- /* height: 700px;*/
- opacity: 0.6;
- animation: newYear3 8s linear;
- -moz-animation: newYear3 8s linear;
- -o-animation: newYear3 8s linear;
- -webkit-animation: newYear3 8s linear;
- }
- .newYear-info .newYear-img img.snow{
- animation: newYear3-snow 8s linear infinite;
- -moz-animation: newYear3-snow 8s linear infinite;
- -o-animation: newYear3-snow 8s linear infinite;
- -webkit-animation: newYear3-snow 8s linear infinite;
- }
- .newYear-info a {
- position:relative;
- z-index:100000;
- display:block;
- top:-200px;
- left:295px;
- width: 45px;
- height: 45px;
- background: url('/images/christmas/close.png')no-repeat center center;
- animation: newYear4 3s linear;
- -moz-animation: newYear4 3s linear;
- -o-animation: newYear4 3s linear;
- -webkit-animation: newYear4 3s linear;
- }
- @keyframes newYear1 {
- 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
- 25%{top: -317px;left: -295px;transform:scale(0.9);}
- 75%{top: -317px;left: -295px;transform:scale(0.8);}
- 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
- }
- @keyframes newYear1-active {
- /*0%{top: -317px;left: -295px;transform:scale(1);}*/
- 0%{top: -317px;left: -295px;transform:scale(0.8);}
- 100%{top: -317px;left: -295px;transform:scale(0.9);}
- }
- @-webkit-keyframes newYear1 {
- 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
- 25%{top: -317px;left: -295px;transform:scale(0.9);}
- 75%{top: -317px;left: -295px;transform:scale(0.8);}
- 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
- }
- @-moz-keyframes newYear1 {
- 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
- 25%{top: -317px;left: -295px;transform:scale(0.9);}
- 75%{top: -317px;left: -295px;transform:scale(0.8);}
- 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
- }
- @-o-keyframes newYear1 {
- 0%{top: -317px;left: -295px;transform:scale(0);opacity:0;}
- 25%{top: -317px;left: -295px;transform:scale(0.9);}
- 75%{top: -317px;left: -295px;transform:scale(0.8);}
- 100%{top: -317px;left: -295px;transform:scale( 1);opacity:1;}
- }
- @keyframes newYear2 {
- /*0%{ opacity:0;}*/
- /*100%{transform:scale( 1);opacity:0.6;}*/
- 0%{ opacity: 0 }
- 25%{opacity: 0}
- 50%{opacity: 0}
- 75%{opacity: 0}
- 80%{opacity: 0}
- 90%{opacity: 0}
- 100%{opacity: 1}
- }
- @keyframes newYear2-occur {
- 0%{transform:scale(0.8);opacity:0.8;}
- 100%{transform:scale( 1);opacity:1;}
- }
- @-webkit-keyframes newYear2 {
- 0%{ opacity: 0 }
- 25%{opacity: 0}
- 50%{opacity: 0}
- 75%{opacity: 0}
- 80%{opacity: 0}
- 90%{opacity: 0}
- 100%{opacity: 1}
- }
- @-moz-keyframes newYear2 {
- 0%{ opacity: 0 }
- 25%{opacity: 0}
- 50%{opacity: 0}
- 75%{opacity: 0}
- 80%{opacity: 0}
- 90%{opacity: 0}
- 100%{opacity: 1}
- }
- @-o-keyframes newYear2 {
- 0%{opacity: 0 }
- 25%{opacity: 0}
- 50%{opacity: 0}
- 75%{opacity: 0}
- 80%{opacity: 0}
- 90%{opacity: 0}
- 100%{opacity: 1}
- }
- @keyframes newYear3 {
- 0%{ top: -280px;opacity: 0}
- 100%{top: -5px;opacity: 0.6}
- }
- @keyframes newYear3-snow {
- 0%{ top: -280px;opacity: 0.6}
- 100%{top: -5px;opacity: 0.6}
- }
- @-webkit-keyframes newYear3 {
- 0%{ top: -280px;opacity: 0}
- 100%{top: -5px;opacity: 0.6}
- }
- @-moz-keyframes newYear3{
- 0%{ top: -280px;opacity: 0}
- 100%{top: -5px;opacity: 0.6}
- }
- @-o-keyframes newYear3 {
- 0%{ top: -280px;opacity: 0}
- 100%{top: -5px;opacity: 0.6}
- }
- @keyframes newYear4 {
- 0%{ opacity: 0}
- 100%{ opacity: 1}
- }
- @-webkit-keyframes newYear4 {
- 0%{ opacity: 0}
- 100%{ opacity: 1}
- }
- @-moz-keyframes newYear4 {
- 0%{ opacity: 0}
- 100%{ opacity: 1}
- }
- @-o-keyframes newYear4 {
- 0%{ opacity: 0}
- 100%{ opacity: 1}
- }
- </style>
|