Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Image 1
Image 2
Image 3
Image 4
Image 5
>
css
body { width: 100vw; height: 100vh; display: flex; justify-content: center; align-items: center; } .container { width: 400px; height: 267px; margin: 16px; box-shadow: 0 0 40px 30px rgba(0,0,0, .2); } img { max-width: 100%; } .image { position: absolute; transform-origin: 100% 100%; } .text { position: absolute; top: 10%; right: -15%; color: black; background-color: white; padding: 10px 20px; font-family: 'Sriracha', cursive; letter-spacing: 1px; font-size: 20px; border-radius: 5px; } .button { padding: 8px 10px; font-size: 32px; background: transparent; outline: none; border: 3px solid black; cursor: pointer; color: black; } .image { z-index: 0; } .image-1 { z-index: 2; } .image-2 { z-index: 1; } .image-5 { z-index: -1; }
JavaScript
let images = document.querySelectorAll('.image'); const root = document.documentElement; const elements = ['.image-1', '.image-2', '.image-3', '.image-4', '.image-5'] const totalImages = images.length; let currentImage = 1; let nextImage = currentImage + 1; let upcomingImage = nextImage + 1; function filterActiveImages(image1, image2) { const filteredResult = elements.filter((element) => element !== image1 && element !== image2) return filteredResult; } function slideImage(currentImage,nextImage, upcomingImage ) { let tl = gsap.timeline({defaults: {duration: 0.8, ease: Power1.easeInOut}}); tl.to(`.image-${currentImage}`, {rotation: -10, xPercent: -100}) .to(`.image-${currentImage}`, {rotation: 0, xPercent: 0}) .to(`.image-${nextImage}`, {zIndex: 2 }, "-=1.6") .to(`.image-${currentImage}`, {zIndex: -1}, "-=1.6") .to(`.image-${upcomingImage}`, {zIndex: 1}, "-=1.6") .to(filterActiveImages(`.image-${nextImage}`,`.image-${currentImage}`), {zIndex:0}, "-=2.4") return tl; } function nextAnimation () { slideImage(currentImage, nextImage, upcomingImage); currentImage = nextImage; nextImage = currentImage - 1; if (currentImage === 1) { nextImage = totalImages } if (nextImage === 1) { upcomingImage = totalImages } else { upcomingImage = nextImage - 1; } }
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>gsap滑块轮播图-jq22.com</title> <script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script> <style>
</style> </head> <body>
<script>
</script>
</body> </html>
2012-2021 jQuery插件库版权所有
jquery插件
|
jq22工具库
|
网页技术
|
广告合作
|
在线反馈
|
版权声明
沪ICP备13043785号-1
浙公网安备 33041102000314号