Toggle navigation
在线编辑器
在线代码
文本比较
jQuery下载
前端库
在线手册
登录/注册
下载代码
html
css
js
分享到微信朋友圈
X
html
Use your finger to swipe it up and down :)
css
body { display: -webkit-box; display: flex; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; -webkit-box-pack: center; justify-content: center; -webkit-box-align: center; align-items: center; height: 100vh; background: #f7f7fd; margin: 0; } .swiper { position: absolute; width: 120px; height: 468px; cursor: pointer; } .camera { --d-carousel-item-gap: 5px; --d-carousel-transition: 0.3s; --d-carousel-perspective: 250px; --d-carousel-rotate-x: 0; --d-carousel-translate-z: -100px; --d-carousel-item-width: 45px; --d-carousel-item-height: 45px; --d-carousel-item-gap-double: calc(var(--d-carousel-item-gap) * 2); --camera-width: calc( var(--d-carousel-item-width) + var(--d-carousel-item-gap-double) ); --camera-height: calc( var(--d-carousel-item-height) + var(--d-carousel-item-gap-double) ); position: relative; width: var(--camera-width); height: var(--camera-height); -webkit-perspective: var(--d-carousel-perspective); perspective: var(--d-carousel-perspective); pointer-events: none; } .camera .d-carousel { position: absolute; width: 100%; height: 100%; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform: translateZ(var(--d-carousel-translate-z)) rotateX(var(--d-carousel-rotate-x)); transform: translateZ(var(--d-carousel-translate-z)) rotateX(var(--d-carousel-rotate-x)); -webkit-transition: var(--d-carousel-transition); transition: var(--d-carousel-transition); pointer-events: none; } .camera .d-carousel-item { --d-carousel-item-rotate-x: calc(var(--i) * var(--d-carousel-item-deg)); --d-carousel-item-translate-z: var(--d-carousel-item-r); position: absolute; left: var(--d-carousel-item-gap); top: var(--d-carousel-item-gap); width: var(--d-carousel-item-width); height: var(--d-carousel-item-height); border-radius: 5px; -webkit-backface-visibility: hidden; backface-visibility: hidden; pointer-events: none; -webkit-transform: rotateX(var(--d-carousel-item-rotate-x)) translateZ(var(--d-carousel-item-translate-z)); transform: rotateX(var(--d-carousel-item-rotate-x)) translateZ(var(--d-carousel-item-translate-z)); } .tip { position: absolute; top: 4rem; }
JavaScript
"use strict"; var getTanFromDegrees = function (deg) { return Math.tan((deg * Math.PI) / 180); }; var camera = document.querySelector(".camera"); var cameraHeight = camera.offsetHeight; var swiper = document.querySelector(".swiper"); var swiperHeight = swiper.offsetHeight; var dCarousel = document.querySelector(".d-carousel"); var dCarouselItems = dCarousel.children; var dCarouselItemCount = dCarouselItems.length; var dCarouselItemDeg = 360 / dCarouselItemCount; var dCarouselItemTanDegHalf = Math.tan(getTanFromDegrees(dCarouselItemDeg / 2)); var dCarouselItemR = cameraHeight / 2 / dCarouselItemTanDegHalf; dCarousel.style.setProperty("--d-carousel-item-r", dCarouselItemR + "px"); dCarousel.style.setProperty("--d-carousel-item-deg", dCarouselItemDeg + "deg"); Array.from(dCarouselItems).forEach(function (item, i) { return item.style.setProperty("--i", "" + i); }); var swipeDeg = 0; var previousDeltaY = 0; var deltaYDelta = 0; var manager = new Hammer.Manager(swiper); var Pan = new Hammer.Pan({ threshold: 10 }); manager.add(Pan); manager.on("pan", function (e) { var deltaY = e.deltaY; deltaYDelta = deltaY - previousDeltaY; previousDeltaY = deltaY; var direction = e.offsetDirection; if (direction === 8 || direction === 16) { var swipeDegDelta = (deltaYDelta / swiperHeight) * 360; swipeDeg -= swipeDegDelta; dCarousel.style.setProperty("--d-carousel-rotate-x", swipeDeg + "deg"); } if (e.isFinal) { previousDeltaY = 0; } }); var disableTouchMove = function () { document.body.addEventListener("touchmove", function (e) { e.preventDefault(); }, { passive: false }); }; disableTouchMove();
粒子
时间
文字
hover
canvas
3d
游戏
音乐
火焰
水波
轮播图
鼠标跟随
动画
css
加载动画
导航
菜单
按钮
滑块
tab
弹出层
统计图
svg
×
Close
在线代码下载提示
开通在线代码永久免费下载,需支付20jQ币
开通后,在线代码模块中所有代码可终身免费下!
您已开通在线代码永久免费下载,关闭提示框后,点下载代码可直接下载!
您已经开通过在线代码永久免费下载
对不起,您的jQ币不足!可通过发布资源 或
直接充值获取jQ币
取消
开通下载
<!doctype html> <html> <head> <meta charset="utf-8"> <title>3d滑动轮播图-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号