效果呈现来源于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": "https://m.zqins.com/public/static/sj/img/3d/style1.png",
"href": "https://m.zqins.com/xiaoguotu/?hx=129&&lx=&&fg=&&jb="
},

{ "erd": 图片id,
"yid": 3,
"src": "https://m.zqins.com/public/static/sj/img/3d/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}});
$(document).ready(function(){
var c = $(".find-tab").find("span").eq(0).attr("value");
var slides=[];
$.each(sandJson,
function(h, j) {
if (j.yid == c) {
for(var i=0;i<1;i++) {
slides.push(j);
}
}
});
$(".find-tab span").click(function() {
var h = $(".find-span-active").attr("value");
$(".jR3DCarouselGallery").empty();
var slides=[];
$.each(sandJson,
function(j, k) {
if (k.yid == h) {
for(var i=0;i<1;i++) {
slides.push(k);
}
}
})
carouselPropsA(slides);
});
carouselPropsA(slides);
})
function carouselPropsA(slides){
var jR3DCarousel;
var carouselProps = {
width: 300,
height:185,
slideLayout : 'contain',
animation: 'slide3D',
animationCurve: 'ease',
animationDuration: 700,
animationInterval: 1000,
autoplay: true,
navigation: 'none',
slides: slides,
perspective: 450
}
function setUp(){
jR3DCarousel = $('.jR3DCarouselGallery').jR3DCarousel(carouselProps);
}
setUp()
}

												

78.3D立体轮播图(完整兼容手机端和pc端)的更多相关文章

  1. 案例:3D切割轮播图

    一.3d转换 3D旋转套路:顺着轴的正方向看,顺时针旋转是负角度,逆时针旋转是正角度 二.代码 <!DOCTYPE html> <html lang="en"&g ...

  2. 带锁的3D切割轮播图

    3D切割轮播图. 加入锁,限制点击太快次数 <!DOCTYPE html><html><head lang="en"> <meta cha ...

  3. js访3d上下轮播图

    js/css访3d上下轮播图 (附件) <!DOCTYPE html> <html> <head> <meta charset="utf-8&quo ...

  4. css3实现3D切割轮播图案例

    <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...

  5. CSS3,3D效果轮播图

    ---恢复内容开始--- 大家还记得我昨天的3D拖拽立方体吗??我昨天还说过css还可以做轮播图,所以咱们今天就写一下,css的轮播图吧! ....这个轮播图主要是用CSS3里的transform的旋 ...

  6. 3D切割轮播图

    预览图: 实现原理:将图片切割构建一个和ul(电脑屏幕)同一个轴的立方体,利用延时旋转实现切割效果 知识点:transform-style属性(必须搭配transform属性使用) 值 描述 flat ...

  7. bootstrap轮播图组件

    一.轮播图组件模板(官方文档) <div id="carousel-example-generic" class="carousel slide" dat ...

  8. 自己用原生JS写的轮播图,支持移动端触屏滑动,面向对象思路。分页器圆点支持click和mouseover。

    自己用原生javascript写的轮播图,面向对象思路,支持移动端手指触屏滑动.分页器圆点可以选择click点击或mouseover鼠标移入时触发.图片滚动用的setInterval,感觉setInt ...

  9. jquery版本轮播图(es5版本,兼容高)

    优势:基于es5,兼容高.切换动画css配置,轻量,不包含多余代码,可扩展性很高,多个轮播图不会冲突,可配置独有namespace 注: 1.项目需要所写,所以只写了页码的切换,未写上一页下一页按钮, ...

随机推荐

  1. centos 7 服务初始化

    更新yum源及必要软件安装 yum groupinstall "Development tools" "Compatibility libraries" yum ...

  2. uiautomator 安装和升级

    1.打开uiautomator sdk安装路径 < tools < uiautomatorviewer.bat # 双击点开 2.升级uiautomator包 1.uiautomatorv ...

  3. onchange onpropertychange 和 oninput 事件的区别

    onchange 事件在内容改变(两次内容有可能还是相等的)且失去焦点时触发. onpropertychange 事件却是实时触发,即每增加或删除一个字符就会触发,通过 js 改变也会触发该事件,但是 ...

  4. 跨交换机VLAN之间的通信(基于Cisco模拟器)

    实验要求: 拓扑结构如下 1.交换机2台:主机4台:网线若干. 2.把主机.交换机进行互联. 3.给2台交换机重命名为A.B. 4.设置2台交换机及主机的ip.注意IP要不冲突 5.在2台交换机上分别 ...

  5. A1083 List Grades (25 分)

    Given a list of N student records with name, ID and grade. You are supposed to sort the records with ...

  6. 本地手动一步步搭建WNMP环境(nginx+php+mysql) Windows平台

    环境:Windows 10 x64 参考文章: WNMP完整教程      windows下PHP环境的搭建 我自定义安装后的目录结构: +WNMP ++MySQL_Server-8.0.13 ++n ...

  7. 使用 Java 执行 groovy 脚本或方法

    1. 引入依赖 <dependency> <groupId>org.codehaus.groovy</groupId> <artifactId>groo ...

  8. oracle--查询速度慢

    查询速度慢的原因很多,常见如下几种: 1,  没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷) 2, I/O吞吐量小,形成了瓶颈效应. 3, 没有创建计算列导致查询不优化. 4, ...

  9. SpringBoot集成Spring Security(1)——入门程序

    因为项目需要,第一次接触 Spring Security,早就听闻 Spring Security 功能强大但上手困难,学习了几天出入门道,特整理这篇文章希望能让后来者少踩一点坑(本文附带实例程序,请 ...

  10. Python 中 如何将两个列表元素一一对应成字典

    使用python的 zip函数 和强大的集合操作可以方便的将两个list元素一一对应转换为dict,如下示例代码: names = ['n1','n2','n3'] values = [1,2,3] ...