微学网

热门关键词:   as  thinkphp  ecshop  xxx  商务通  www.ymwears.cn
热门: ASP.NET PHP编程 ASP编程 JSP编程 Python

78.3D立体轮播图(完整兼容手机端和pc端)

发布时间:2020-03-11 来源:未知 点击:

效果呈现来源于http://www.jq22.com/demo/jR3DCarousel-master20160315/

在此基础上改成需要的3个分类的3D图

由于原有的不支持粘贴复制显示3个分类

我通过点击分类去获取当前分类下的图片路径生成3d

最后发现每一种分类下图片要么都是小于8张,

要么都是大于8张,此目的是因为保证每个3d图角度一样

修改后的效果可以去https://m.zqins.com/参观

html:

<div class="find-tab">
<span class="find-span-active" value="1"><b>户型</b><i></i></span>
<span value="2"><b>风格</b><i></i></span>
<span value="3"><b>空间</b><i></i></span>
</div>
<div class="find-slide">
<ul class="find-ul find-ul-active">
<div class="jR3DCarouselGallery"></div>
</ul>
</div>

js:

sandJson为图片数组。

var sandJson=[
{
"erd": 图片id,
"yid": 1,
"src": "图片路径",
"href": "a链接"
},
{
"erd":图片id,
"yid": 2,
"src": "http://www.weixuecn.cn/uploads/cj/style1.png",
"href": "https://m.zqins.com/xiaoguotu/?hx=129&&lx=&&fg=&&jb="
},

{ "erd": 图片id,
"yid": 3,
"src": "http://www.weixuecn.cn/uploads/cj/kong1.png",
"href": "https://m.zqins.com/xiaoguotu/?hx=&&lx=142&&fg=&&jb="
},

]

引入此js,如果需要修改3d的HTML,可以在此js里修改循环语句。

/**
 * Author: Vinayak Rangnathrao Jadhav
 * Project: jR3DCarousel
 * Version: 0.0.8
 **/
(function(g){"function"===typeof define&&define.amd?define(["jquery"],g):"object"===typeof exports?module.exports=g(require("jquery")):g(jQuery)})(function(g){g.fn.jR3DCarousel=function(y){function x(){this.animations={slide:A,slide3D:B,scroll:C,scroll3D:D,fade:E}}function A(a){d.css({perspective:"",overflow:"hidden"});c=f*a;h.css({transform:"translateZ("+-e+"px) rotateY("+-c+"deg)"});u()}function B(a){d.css({perspective:k,overflow:"visible"});c=f*a;h.css({transform:"translateZ("+-e+"px) rotateY("+
-c+"deg)"});u()}function C(a){d.css({perspective:"",overflow:"hidden"});c=f*a;h.css({transform:"translateZ("+-e+"px) rotateX("+-c+"deg)"});u()}function D(a){d.css({perspective:k,overflow:"visible"});c=f*a;h.css({transform:"translateZ("+-e+"px) rotateX("+-c+"deg)"});u()}function E(g){h.css({transition:"opacity "+a.animationDuration+"ms "+a.animationCurve,opacity:0});d.find(".nav").css({backgroundColor:"rgba(255, 255, 255, 0.77)"}).eq(m%b).css({backgroundColor:"rgba(0, 0, 0, 1)"});clearTimeout(k);var k=
    setTimeout(function(){c=f*g;h.css({transform:"translateZ("+-e+"px) rotateY("+-c+"deg)",opacity:1});l=(Math.round(c/f)-1)%b;a.onSlideShow.call(this,h.find("."+a.slideClass).eq((l+1)%b))},a.animationDuration)}function u(){d.find(".nav").css({backgroundColor:"rgba(255, 255, 255, 0.77)"}).eq(m%b).css({backgroundColor:"rgba(0, 0, 0, 0.77)"});l=(Math.round(c/f)-1)%b;a.onSlideShow.call(this,h.find("."+a.slideClass).eq((l+1)%b))}function z(){d.width("100%");n=d.width()<a.width?d.width():a.width;t=n/G;d.css({width:n+
"px",height:t+"px"});-1!=a.animation.indexOf("slide")?(e=n/2/Math.tan(Math.PI/b),k=n/2*Math.tan(2*Math.PI/b)+"px"):-1!=a.animation.indexOf("scroll")?(e=t/2/Math.tan(Math.PI/b),k=t/2*Math.tan(2*Math.PI/b)+"px"):"fade"==a.animation&&(e=n/2/Math.tan(Math.PI/b),k=n/2*Math.tan(2*Math.PI/b)+"px");d.find("."+a.slideClass).each(function(d){var b=g(this);-1!=a.animation.indexOf("slide")?p="rotateY("+f*d+"deg) translateZ("+e+"px)":-1!=a.animation.indexOf("scroll")?p="rotateX("+f*d+"deg) translateZ("+e+"px)":
    "fade"==a.animation&&(p="rotateY("+f*d+"deg) translateZ("+e+"px)");b.css({transform:p})});k=a.perspective||k;h.css({transform:"translateZ("+-e+"px) rotateY("+-c+"deg)"});d.css({perspective:k})}var a=g.extend(!0,{},{width:1349,height:668,slides:[],slideLayout:"fill",perspective:0,animation:"slide3D",animationCurve:"ease",animationDuration:700,animationInterval:2E3,autoplay:!0,controls:!0,slideClass:"jR3DCarouselSlide",navigation:"circles",onSlideShow:function(){}},y),d=this,n=a.width,t=a.height,G=
    a.width/a.height,h=g("<div class='jR3DCarousel' />").css({width:"100%",height:"100%",transition:"transform "+a.animationDuration+"ms "+a.animationCurve,transformStyle:"preserve-3d"}).appendTo(d),l=0,m=1,w=new x,q,r,v,f,c=0,e,k,p,b=a.slides.length||d.find("."+a.slideClass).length;(function(){function F(){q=g("<div class='previous controls' style='left: 8px; transform: rotate(-45deg);'></div>");r=g("<div class='next controls' style='right: 8px; transform: rotate(135deg);'></div>");q.add(r).appendTo(d).css({position:"absolute",
    top:"42%",zIndex:1,display:"inline-block",padding:"1.2em",boxShadow:"2px 2px 0 rgba(255,255,255,0.9) inset",cursor:"pointer"}).hide();q.on("click",function(){l=Math.round(c/f);m=l-1;w.run(a.animation,m)});r.on("click",function(){l=Math.round(c/f);m=l+1;w.run(a.animation,m)});d.on("mouseenter touchstart",function(){q.add(r).fadeIn()}).on("mouseleave touchcancel",function(){q.add(r).fadeOut()});g(document).on("keydown",function(a){var b=d[0].getBoundingClientRect();(b=0<b.bottom&&0<b.right&&b.left<
    (innerWidth||document.documentElement.clientWidth)&&b.top<(innerHeight||document.documentElement.clientHeight))&&37==a.which?(clearInterval(v),q.click()):b&&39==a.which&&(clearInterval(v),r.click())});u(d,function(b){clearInterval(v);"left"==b?r.click():"right"==b?q.click():-1!=a.animation.indexOf("scroll")&&("down"==b?r.click():"up"==b&&q.click())})}function u(a,b){var d,f,e,g,c,h,k;a.on("touchstart",function(a){a=a.originalEvent.changedTouches[0];d="none";f=a.pageX;e=a.pageY;k=(new Date).getTime()}).on("touchmove",
    function(a){a.preventDefault()}).on("touchend",function(a){a=a.originalEvent.changedTouches[0];g=a.pageX-f;c=a.pageY-e;h=(new Date).getTime()-k;700>=h&&(20<=Math.abs(g)&&100>=Math.abs(c)?d=0>g?"left":"right":20<=Math.abs(c)&&100>=Math.abs(g)&&(d=0>c?"up":"down"));b(d)})}function x(){for(var f=a.navigation,e=g("<div class=navigation />").css({position:"absolute",bottom:0,right:0}),c=0;c<b;c++)e.append("<div class=nav></div>");"circles"==f&&e.find(".nav").css({borderRadius:"12px"});e.find(".nav").css({display:"inline-block",
    margin:"5px",cursor:"pointer",backgroundColor:"rgba(255, 255, 255, 0.77)",width:"12px",height:"12px",transition:"all "+a.animationDuration+"ms ease"}).first().css({backgroundColor:"rgba(0, 0, 0, 1)"});h.after(e);d.on("click",".nav",function(){m=g(this).index();w.run(a.animation,m)})}function y(){v=setInterval(function(){l=Math.round(c/f);m=l+1;w.run(a.animation,m)},a.animationInterval+a.animationDuration);d.hover(function(){clearInterval(v)},function(){v=setInterval(function(){l=Math.round(c/f);m=
    l+1;w.run(a.animation,m)},a.animationInterval+a.animationDuration)})}(function(){-1!=a.animation.indexOf("slide")?(e=n/2/Math.tan(Math.PI/b),k=n/2*Math.tan(2*Math.PI/b)+"px"):-1!=a.animation.indexOf("scroll")?(e=t/2/Math.tan(Math.PI/b),k=t/2*Math.tan(2*Math.PI/b)+"px"):"fade"==a.animation&&(e=n/2/Math.tan(Math.PI/b),k=n/2*Math.tan(2*Math.PI/b)+"px");f=360/b;if(a.slides.length)for(var c=0;c<a.slides.length;c++){var l=g("<div class='jR3DCarouselSlide' data-index="+c+" />").append("<a href='" + a.slides[c].href + "'><img src='"+a.slides[c].src+
    "' alt='"+a.slides[c].alt+"' /></a>");-1!=a.animation.indexOf("slide")?p="rotateY("+f*c+"deg) translateZ("+e+"px)":-1!=a.animation.indexOf("scroll")?p="rotateX("+f*c+"deg) translateZ("+e+"px)":"fade"==a.animation&&(p="rotateY("+f*c+"deg) translateZ("+e+"px)");l.css({transform:p});h.append(l)}else d.find("."+a.slideClass).each(function(b){var c=g(this).attr("data-index",b);-1!=a.animation.indexOf("slide")?p="rotateY("+f*b+"deg) translateZ("+e+"px)":-1!=a.animation.indexOf("scroll")?p="rotateX("+f*b+"deg) translateZ("+
    e+"px)":"fade"==a.animation&&(p="rotateY("+f*b+"deg) translateZ("+e+"px)");c=c.css({transform:p}).detach();h.append(c)});h.find("."+a.slideClass).css({position:"absolute",left:0,top:0,width:"100%",height:"100%",backfaceVisibility:"hidden"}).find("img").css({width:"100%",height:"100%",objectFit:a.slideLayout});k=a.perspective||k;d.css({perspective:k,width:n+"px",height:t+"px",position:"relative",overflow:"visible"})})();a.controls&&F();a.navigation&&x();a.autoplay&&y();addEventListener("resize",z);
    z()})();x.prototype.run=function(a,b){this.animations[a](b)};this.showSlide=function(a){h.find(".nav").eq((a-1)%b).click()};this.getCurrentSlide=function(){return h.find("."+a.slideClass).eq(l)};this.getSlideByIndex=function(b){return h.find("."+a.slideClass+"[data-index="+b+"]")};this.showPreviousSlide=function(){q.click()};this.showNextSlide=function(){r.click()};return this}});

这就是微学网-程序员之家为你提供的"78.3D立体轮播图(完整兼容手机端和pc端)"希望对你有所帮助.本文来自网络,转载请注明出处:http://www.weixuecn.cn/article/9837.html
网络编程 | 前端制作 | 数据库 | CMS教程 | 脚本编程 | 框架 | 服务器 | 微信开发 | APP开发 | 学习教程 |

凡本网站转载的文章、图片等资料的版权归版权所有人所有,因无法和版权所有者一一联系,如果本网站选取的文/图威胁到您的权益,请您及时和本网站联系。 我们会在第一时间内采取措施,避免给双方造 成不必要的损失。
© 2015-2021 微学网 版权所有,并保留所有权利。 备案号:粤ICP备09051474号-1

菜鸟学习网,提供各类程序编程入门,技巧,手机游戏下载站