您现在的位置是:网站首页> 编程资料编程资料
HTML+CSS+JavaScript实现图片3D展览的示例代码利用CSS3制作简单的3d半透明立方体图片展示使用CSS3实现一个3D相册效果实例CSS3制作炫酷带方向感应的鼠标滑过图片3D动画css3实现超立体3D图片侧翻倾斜效果
2021-08-30
1693人已围观
简介 这篇文章主要介绍了HTML+CSS+JavaScript实现图片3D展览的示例代码。文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
一、图片3D展览效果
上传图片的大小有限制,录制的GIF图展示效果不是很好

录屏的效果见链接:https://www.bilibili.com/video/BV1Bi4y1E7wk/
二、代码实现
1. HTML代码
图片3D展览屋 CSDN文章
2. CSS代码
#icon { background: rgb(255, 144, 0); border-radius: 6px 0px 0px; transition:0.6s ease-in-out; left: 65px; top: 6px; width: 40px; height: 40px; overflow: hidden; position: relative; cursor: pointer; -moz-transition: all 0.6s ease-in-out 0s; -webkit-transition: all 0.6s ease-in-out 0s; -o-transition: all 0.6s ease-in-out 0s; } #icon div { background: none; position: absolute; } #icon div:nth-child(1) { border-width: 7px 0px 7px 8px; border-style: solid; border-color: transparent rgb(255, 255, 255); left: 20px; top: 50%; width: 0px; height: 0px; margin-top: -7px; position: absolute; } #icon div:nth-child(2) { background: rgb(255, 255, 255); left: 12px; top: 50%; width: 8px; height: 6px; margin-top: -3px; position: absolute; } #nav { top: 10px; width: 100px; height: 0px; position: absolute; -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none; } #nav-switch { display: none; } #nav .label { display: block; cursor: pointer; } #nav .container { transition:left 0.3s ease-in-out; left: -100px; width: 100%; position: absolute; -moz-transition: left 0.3s ease-in-out 0s; -webkit-transition: left 0.3s ease-in-out 0s; -o-transition: left 0.3s ease-in-out 0s; } #nav .container > div { padding: 0px; width: 50%; float: left; } #nav .container .nav-on { color: rgb(51, 51, 51); padding-left: 0px; } #nav .container .nav-off { width: 40px; height: 40px; padding-right: 10px; } :checked#nav-switch + .label .container { left: 10px; } :checked#nav-switch + .label #icon { background: rgb(0, 101, 203); border-radius: 0px 0px 6px; transform: rotate(-180deg); -webkit-transform: rotate(-180deg); -moz-transform: rotate(-180deg); -o-transform: rotate(-180deg); } .title { margin: 0px; padding: 0px; left: 170px; top: 2px; height: 40px; color: rgb(51, 51, 51); line-height: 40px; font-family: "Segoe UI Light", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; font-size: 24px; font-weight: bold; white-space: nowrap; position: absolute; -ms-user-select: none; -webkit-user-select: none; -moz-user-select: none; -o-user-select: none; user-select: none; } .menu { margin: 0px; padding: 0px; left: 0px; top: 6px; color: rgb(51, 51, 51); font-family: "Segoe UI Light", "Segoe UI", Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif; font-size: 1em; font-weight: lighter; list-style-type: none; position: relative; cursor: pointer; } .menu li { list-style: none; width: 100px; height: 40px; border-right-color: rgb(221, 221, 221); border-right-width: 1px; border-right-style: solid; position: relative; cursor: pointer; } .menu a { color: rgb(51, 51, 51); line-height: 40px; padding-left: 40px; text-decoration: none; display: block; position: relative; } .menu li a:hover { background: rgb(255, 144, 0); } .menu li a:focus { background: rgb(255, 144, 0); } .menu li a:active { background: rgb(255, 144, 0); } #nav li::before { top: 50%; margin-left: 10px; position: absolute; content: ""; } #nav li::after { top: 50%; margin-left: 10px; position: absolute; content: ""; } #nav li a::before { top: 50%; margin-left: 10px; position: absolute; content: ""; } #nav li a::after { top: 50%; margin-left: 10px; position: absolute; content: ""; } #nav .home a::before { border-width: 8px 7px; border-style: solid; border-color: transparent transparent rgb(51, 51, 51); left: 2px; margin-top: -16px; } #nav .home a::after { border-width: 3px 4px 0px; border-style: solid; border-color: rgb(51, 51, 51) rgb(51, 51, 51) transparent; left: 4px; width: 2px; height: 4px; margin-top: 0px; } #nav .arrow a::before { border-width: 7px 0px 7px 8px; border-style: solid; border-color: transparent rgb(51, 51, 51); left: 8px; margin-top: -7px; } #nav .arrow a::after { background: rgb(51, 51, 51); left: 0px; width: 8px; height: 6px; margin-top: -3px; } #nav .back.arrow a::before { border-width: 7px 8px 7px 0px; left: 0px; } #nav .back.arrow a::after { left: 8px; } #nav .list a::before { background: none; border-width: 6px 0px; border-style: double; border-color: rgb(51, 51, 51); left: 5px; top: 14px; width: 12px; height: 2px; } #nav .list a::after { background: none; border-width: 6px 0px; border-style: double; border-color: rgb(51, 51, 51); left: 1px; top: 14px; width: 2px; height: 2px; } 3. JavaScript代码
// ===== ge1doot global ===== js文件1 var ge1doot = ge1doot || { json: null, screen: null, pointer: null, camera: null, loadJS: function (url, callback, data) { if (typeof url == "string") url = [url]; var load = function (src) { var script = document.createElement("script"); if (callback) { if (script.readyState){ script.onreadystatechange = function () { if (script.readyState == "loaded" || script.readyState == "complete"){ script.onreadystatechange = null; if (--n === 0) callback(data || false); } } } else { script.onload = function() { if (--n === 0) callback(data || false); } } } script.src = src; document.getElementsByTagName("head")[0].appendChild(script); } for (var i = 0, n = url.length; i < n; i++) load(url[i]); } } // ===== html/canvas container ===== ge1doot.Screen = function (setup) { ge1doot.screen = this; this.elem = document.getElementById(setup.container) || setup.container; this.ctx = this.elem.tagName == "CANVAS" ? this.elem.getContext("2d") : false; this.style = this.elem.style; this.left = 0; this.top = 0; this.width = 0; this.height = 0; this.cursor = "default"; this.setup = setup; this.resize = function () { var o = this.elem; this.width = o.offsetWidth; this.height = o.offsetHeight; for (this.left = 0, this.top = 0; o != null; o = o.offsetParent) { this.left += o.offsetLeft; this.top += o.offsetTop; } if (this.ctx) { this.elem.width = this.width; this.elem.height = this.height; } this.setup.resize && this.setup.resize(); } this.setCursor = function (type) { if (type !== this.cursor && 'ontouchstart' in window === false) { this.cursor = type; this.style.cursor = type; } } window.addEventListener('resize', function () { ge1doot.screen.resize(); }, false); !this.setup.resize && this.resize(); } // ==== unified touch events handler ==== ge1doot.Pointer = function (setup) { ge1doot.pointer = this; var self = this; var body = document.body; var html = document.documentElement; this.setup = setup; this.screen = ge1doot.screen; this.elem = this.screen.elem; this.X = 0; this.Y = 0; this.Xi = 0; this.Yi = 0; this.bXi
相关内容
- HTML5逐步分析实现拖放功能的方法HTML5 拖放(Drag 和 Drop)详解与实例代码HTML5中的拖放实现详解HTML5拖放API实现拖放排序的实例代码HTML5拖放效果的实现代码HTML5 拖放功能实现代码
- 移动端HTML5 input常见问题(小结)详解移动端HTML5页面端去掉input输入框的白色背景和边框(兼容Android
- HTML5超文本标记语言的实现方法html5标记文字_动力节点Java学院整理 HTML5 新旧语法标记对我们有什么好处HTML5 b和i标记将被赋予真正的语义自定义html标记替换html5新增元素
- Html5 webRTC简单实现视频调用的示例代码HTML5播放实现rtmp流直播使用HTML5加载音频和视频的实现代码HTML5 video循环播放多个视频的方法步骤HTML5 通过Vedio标签实现视频循环播放的示例代码html5视频自动横过来自适应页面且点击播放功能的实现HTML5基于flash实现播放RTMP协议视频的示例代码
- Html5之webcoekt播放JPEG图片流HTML5播放实现rtmp流直播html5用video标签流式加载的实现基于 HTML5 WebGL 实现的医疗物流系统Html5 实现微信分享及自定义内容的流程HTML5 canvas 瀑布流文字效果的示例代码HTML5移动端手机网站开发流程HTML5实现的图片无限加载的瀑布流效果另带边框圆角阴影HTML5梦幻之旅——炫丽的流星雨效果实现过程HTML5 离线应用之打造零请求、无流量网站的解决方法
- 如何在Canvas上的图形/图像绑定事件监听的实现如何在Canvas中添加事件的方法示例html5中监听canvas内部元素点击事件的三种方法详解Canvas事件绑定HTML5 Canvas的事件处理介绍一个不错的HTML5 Canvas多层点击事件监听实例HTML5 Canvas鼠标与键盘事件demo示例详解如何在Canvas中添加事件的方法
- canvas 绘图时位置偏离的问题解决html2canvas生成的图片偏移不完整的解决方法
- 关于canvas.toDataURL 在iOS运行失败的问题解决 详解canvas.toDataURL()报错的解决方案全都在这了canvas.toDataURL image/png 报错处理方法推荐
- canvas绘制图片drawImage使用方法详解canvas drawImage()方法绘制图片不显示的问题HTML5 Canvas API中drawImage()方法的使用实例
- HTML5中外部浏览器唤起微信分享功能的代码html5的pushstate以及监听浏览器返回事件的实现HTML5中外部浏览器唤起微信分享html5使用html2canvas实现浏览器截图的示例处理HTML5新标签的浏览器兼容版问题如何查看浏览器对html5的支持情况
点击排行
本栏推荐
