javascript - 带放大/缩小过渡效果的全屏 slider

标签 javascript animation slider velocity.js gsap

我的意思是这样的。如何使用 GSAP、Transit 或 VelocityJS 等库获得该结果?

http://www.echocapital.com/

提前致谢:)

最佳答案

不知道 GSAP 和 Velocity
因为您所需要的只是一点 CSS 和一些 JS 或 jQuery,我的意思是您可以轻松地用普通 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>

关于javascript - 带放大/缩小过渡效果的全屏 slider ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28128700/

相关文章:

jquery - 重新定位网页上的 'absolute' 元素 - CSS

javascript - JQuery $(window).resize() 函数无法正常工作

javascript - Angular : Is it possible to make Angular directives, 例如 NgIf 和 NgFor,仅在我想要的时候检查它们绑定(bind)的变量?

javascript - PHP - 如何根据使用 javascript 生成的动态内容发布关系

c++ - 如何在 SFML 中为 Sprite 制作动画

iOS - 使用 [layer removeAllAnimations] 移除动画

javascript - 折线图中的点不会隐藏 DC.js d3-tip

javascript - 当屏幕最大化时,div 模式弹出窗口在 IE 上无法正确呈现,在 Chrome 上工作正常

CSS3 强制顺序动画

javascript - Jquery slider 自动刷新变量