Full screen slider with zoom in/out transition effect

半腔热情 提交于 2019-12-22 01:08:21

问题


I mean something like this. How can I obtain that result with a library like GSAP, Transit or VelocityJS?

http://www.echocapital.com/

Thanks in advance :)


回答1:


Dunno about GSAP and Velocity
Cause all you need is a bit of CSS and some JS or jQuery, I mean you can rewrite easily the below in vanilla JS:

var $gal = $("#gallery"), $img = $gal.find("> div"),
    n = $img.length, i = 0, t;

$img.eq(i).addClass('on');

(function loop() {
  t = setTimeout(function(){
    $img.removeClass("on").eq(i++%n).addClass("on");
    loop();
  }, 3000);
}());
*{margin:0;}
html, body{height:100%;background:#444;}
#gallery{
  overflow:hidden;
}
#gallery,
#gallery > div{
  position:absolute;
  top:0; left:0; bottom:0;right:0;
}
#gallery > div{
  background: none 50% / cover;
  transform:scale(0.94);
  transition:0.8s;
  opacity: 0;
}
#gallery > div.on{
  transition-delay: 0.1s;
  transform:scale(1);
  opacity: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="gallery">
    <div style="background-image:url(//placehold.it/800x600/daa&text=1)"></div>
    <div style="background-image:url(//placehold.it/800x600/dad&text=2)"></div>
    <div style="background-image:url(//placehold.it/800x600/ada&text=3)"></div>
  </div>


来源:https://stackoverflow.com/questions/28128700/full-screen-slider-with-zoom-in-out-transition-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!