css 页面从左侧向右滑入,动画只执行一次

简单实现了页面进入时的动画:
(1)从左侧滑入;
(2)只执行一次。

<template>
  <div class="big_screen_contant">
    <div class="contant">
    </div>
  </div>
</template>
<script>
import $ from "jquery";
export default {
  data () {
    return {
    }
  },
  created () {
    this.autoHeight = window.screen.height + "px";
    $("html").css("background", "#03082f");
  },
  mounted () {
    this.getPage();
  },
  beforeDestroy () {
  },
  methods: {
    getPage () {
      $(".big_screen_contant").addClass("contantActive");
      setTimeout(function () {
        $(".big_screen_contant").removeClass("contantActive");
      }, 3000);     
    }
  }
};
</script>
<style lang="less" scoped>
html {
  background: #03082f !important;
  background-size: 100%;
}
</style>
<style lang="less">
.contant {
  width: 600px;
  height: 400px;
  background-color: antiquewhite;
}
.contantActive {
  animation: bounceInLeft 3s cubic-bezier(0.215, 0.61, 0.355, 1) 0s 1 alternate
    forwards;
  -webkit-animation: bounceInLeft 3s cubic-bezier(0.215, 0.61, 0.355, 1) 0s 1
    alternate forwards; /*Safari and Chrome*/
}
@keyframes bounceInLeft {
  0% {
    opacity: 0;
    transform: translate3d(-3000px, 0, 0);
  }
  60% {
    opacity: 1;
    transform: translate3d(-25px, 0, 0);
  }
  75% {
    transform: translate3d(-10px, 0, 0);
  }
  90% {
    transform: translate3d(-5px, 0, 0);
  }
  100% {
    transform: none;
  }
}
</style>

页面效果:
在这里插入图片描述

  • 3
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值