素材牛VIP会员

jQuery超炫酷的火箭冲天返回顶部特效

 所属分类:网页特效-返回顶部

 浏览:2041次  评论:0次  更新时间:2016-12-22
牛币素材VIP可免积分下载
jQuery超炫酷的火箭冲天返回顶部特效兼容IE8
积分说明:注册即送10牛币,每日签到可获得5牛币,成为VIP会员可永久免牛币下载!   充值积分   充值会员   更多说明»
素材描述:这是一款基于gsap的jQuery超炫酷火箭冲天返回顶部特效。
 标签:火箭返回顶部

详细介绍

使用方法:

在页面中引入jquery和TweenMax.min.js,以及ScrollToPlugin.min.js文件

<script src="js/jquery.min.js"></script>
<script src="http://cdn.bootcss.com/gsap/1.19.0/TweenMax.min.js"></script>
<script src="http://cdn.bootcss.com/gsap/1.19.0/plugins/ScrollToPlugin.min.js"></script>

初始化插件

$("#gotop").click(function(e) {
   TweenMax.to(window, 1.5, {scrollTo:0, ease: Expo.easeInOut});
   var huojian = new TimelineLite();
    huojian.to("#gotop1", 1, {rotationY:720, scale:0.6, y:"+=40", ease:  Power4.easeOut})
    .to("#gotop1", 1, {y:-1000, opacity:0, ease:  Power4.easeOut}, 0.6)
    .to("#gotop1", 1, {y:0, rotationY:0, opacity:1, scale:1, ease: Expo.easeOut, clearProps: "all"}, "1.4");
});

CSS样式

为小火箭添加必要的CSS样式:定位方式为fixed,位置固定在页面的右下角。然后在鼠标滑过小火箭时,为小火箭添加rubberBand的animation动画,该动画通过transform函数来对小火箭进行3D缩放。

/* 小火箭css */
#gotop1 {
    width: 80px;
    position: fixed;
    bottom: 90px;
    cursor: pointer;
    z-index: 99998;
    right: 50%;
    margin-right: -620px;
}
  
/* 小火箭悬停特效 */
  
#gotop1:hover {
    animation: rubberBand 1s;
}
  
@keyframes rubberBand {
  from {
    transform: scale3d(1, 1, 1);
  }
  
  30% {
    transform: scale3d(1.25, 0.75, 1);
  }
  
  40% {
    transform: scale3d(0.75, 1.25, 1);
  }
  
  50% {
    transform: scale3d(1.15, 0.85, 1);
  }
  
  65% {
    transform: scale3d(.95, 1.05, 1);
  }
  
  75% {
    transform: scale3d(1.05, .95, 1);
  }
  
  to {
    transform: scale3d(1, 1, 1);
  }
}

HTML结构

返回顶部小火箭的HTML结构如下

<div id="shangxia2">
  <span id="gotop">
    <img src="img/huojian.svg" alt="返回顶部小火箭">
  </span>
</div>

相关素材 - 返回顶部

讨论这个素材(0)回答他人问题或分享使用心得会奖励牛币

〒_〒 居然一个评论都没有……

 文明上网,理性发言!   😉 阿里云幸运券,戳我领取
我的牛币余额:0
所需牛币:1 开始下载

牛币获取:签到、评论、充值    » 在线充值(10牛币=1元)