android 3d 轮播,css3实现图片轮播 - 3D旋转特效

【温馨提示】源码包解压密码:www.youhutong.com

效果图:

8480c728d2a24a7635a64bb0d196efe8.gif

部分源码及使用说明:

1、html部分源码:

  • 1
  • 2
  • 3
  • 4

2、CSS源码部分:

*{ margin:0; padding:0;}

#nnh{

width:350px; height:50px; margin:50px auto; position:absolute; top:-70px;

left:-15px; border:0px solid red;

}

#nnh h1{ text-align:center; color:red;}

#wrap{ width:800px; height:360px; margin:150px auto; position:relative;}

#up{ width:808px; height:360px; -webkit-perspective:800px;}

#up li{ list-style-type:none; height:360px; cellpadding="0" cellspacing="0"

border:1px solid #ff0000; float:left; position:relative;

-webkit-transform-style:preserve-3d;-webkit-transform:translateZ(-180px);

}

#up li span{ height:360px; display:block; position:absolute;}

#up li span:nth-child(1){ background:url(img/1.png);

-webkit-transform:translateZ(180px);

}

#up li span:nth-child(2){ background:url(img/2.png);

-webkit-transform:translateZ(-180px) rotatex(180deg);

}

#up li span:nth-child(3){ background:url(img/3.png); top:-360px;

-webkit-transform-origin:bottom;

-webkit-transform:translateZ(180px) rotateX(90deg);

}

#up li span:nth-child(4){ background:url(img/4.png); top:360px;

-webkit-transform-origin:top;

-webkit-transform:translateZ(180px) rotateX(-90deg);

}

#an_niu{position:absolute; right:5px; bottom:5px;}

#an_niu li{ list-style-type:none; width:20px; height:20px; background:#000;

color:#fff; border-radius:10px;/*画圆按钮*/

box-shadow:0 2px 5px #fff;/*给圆按钮加阴影*/

font-size:12px; line-height:20px; text-align:center;

float:left; margin-left:5px;

}

#an_niu li:hover{background:red; cursor:pointer;}

3、JS源码部分:

function zc(lien){

var lwid = 800/lien;

var htmlDM = "";

var cssDM = "";

var timeDM = "";

var z = 0;

for(var i=0;i

if(i>lien/2){z--}

htmlDM += "

";

cssDM += "#up li:nth-child("+(i+1)+") span{background-position:"+(i*-lwid)+"px;}";

timeDM += "#up li:nth-child("+(i+1)+"){-webkit-transition:0.4s "+((i*0.1)/20)+"s;}"

};

$("#up").append(htmlDM);

$("#yang").append("#up li{width:"+lwid+"px;}#up li span{width:"+lwid+"px;}"+cssDM+timeDM)

};

zc(200);

$("#an_niu li").click(function(){

var a = $(this).index();

var b = -a*90;

$("#up li").css("-webkit-transform","translateZ(-180px) rotateX("+b+"deg)")

});

源码中有详细的使用说明及备注等

浏览器启用弹出窗口过滤功能,将无法跳转到下载页。在浏览器地址栏右边符号提示处点击允许就可以了!

【温馨提示】源码包解压密码:www.youhutong.com

郑重声明:

1、本站源码仅供个人学习研究和交流使用,请于下载后二十四小时内删除

2、本站大多资源来源于互联网、用户分享,仅供学习交流使用,本站不提供任何技术支持

3、本站联系方式Email:admin@youhutong.com ,收到邮件会第一时间处理。

4、如侵犯到任何版权问题,请立即告知本站(立即在线告知),本站将及时删除并致以最深的歉意

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个基本的3D轮播特效代码,包含3张图。你可以根据自己的需求修改和调整样式: HTML代码: ``` <div class="carousel"> <figure class="carousel__item"> <img src="https://via.placeholder.com/500x300" alt="Carousel Image 1"> </figure> <figure class="carousel__item"> <img src="https://via.placeholder.com/500x300" alt="Carousel Image 2"> </figure> <figure class="carousel__item"> <img src="https://via.placeholder.com/500x300" alt="Carousel Image 3"> </figure> </div> ``` CSS代码: ``` .carousel { position: relative; width: 100%; height: 300px; perspective: 1000px; } .carousel__item { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transition: transform 0.5s; transform-style: preserve-3d; } .carousel__item:nth-child(1) { transform: translateZ(0); } .carousel__item:nth-child(2) { transform: rotateY(120deg) translateZ(-300px); } .carousel__item:nth-child(3) { transform: rotateY(240deg) translateZ(-300px); } .carousel:hover .carousel__item { transform: rotateY(-120deg); } ``` 解释说明: - `perspective: 1000px;` 设置透视距离为1000像素,用于创建3D效果 - `.carousel__item` 定义轮播项的样式,设置绝对定位、宽高为100%以及3D变换样式 - `.carousel__item:nth-child(n)` 设置每个轮播项的3D变换,其中 `:nth-child(n)` 表示该样式将应用到第n个子元素 - `.carousel:hover .carousel__item` 定义鼠标悬停时的3D变换,将所有轮播旋转-120度 请注意,这只是一个基本的3D轮播特效,你可以根据自己的需求进行修改和扩展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值