图片/图形

弹性效果的图片展示画廊特效

阿里云


这一款使用纯 js 制作的弹性效果的图片展示画廊特效。该图片展示特效中,图片在鼠标滑过时带有炫酷的弹性晃动效果,并且图片会跟随鼠标移动,整体效果非常的酷。

使用方法

在页面中引入 diapo.js 文件。

也想出现在这里?联系我们
创客主机
  1. <script type="text/javascript" src="js/diapo.js"></script>

HTML 结构

该图片展示画廊的 HTML 结构如下:

  1. <div id="diapoContainer">
  2.       <img class="imgsrc" src="images/1.jpg" alt="Reconsider your Existence">
  3.       <img class="imgsrc" src="images/2.jpg" alt="Something Needs to be Discovered">
  4.       <img class="imgsrc" src="images/3.jpg" alt="They Said Very Little">
  5.       <img class="imgsrc" src="images/4.jpg" alt="Only in Your Mind">
  6.       <img class="imgsrc" src="images/5.jpg" alt="The Power of Imagination">
  7.       <img class="imgsrc" src="images/6.jpg" alt="Objectivity is Impossible">
  8.       <img class="imgsrc" src="images/7.jpg" alt="Cleaning Up Operation">
  9.       <img class="imgsrc" src="images/8.jpg" alt="Arbitrary Contents">
  10.       <div id="bkgcaption"></div>
  11.       <div id="caption"></div>
  12. </div>

CSS 样式

为该图片画廊特效添加下面的必要的 CSS 样式。

  1. html {
  2.   overflow: hidden;
  3. }
  4.  
  5. body {
  6.   margin: 0px;
  7.   padding: 0px;
  8.   background: #000;
  9.   position: absolute;
  10.   width: 100%;
  11.   height: 100%;
  12.   cursor: crosshair;
  13. }
  14.  
  15. #diapoContainer {
  16.   position: absolute;
  17.   left: 10%;
  18.   top: 15%;
  19.   width: 80%;
  20.   height: 80%;
  21.   background: #222;
  22.   overflow: hidden;
  23. }
  24.  
  25. .imgDC {
  26.   position: absolute;
  27.   cursor: pointer;
  28.   border: #000 solid 2px;
  29.   filter: alpha(opacity=90);
  30.   opacity: 0.9;
  31.   visibility: hidden;
  32. }
  33.  
  34. .spaDC {
  35.   position: absolute;
  36.   filter: alpha(opacity=20);
  37.   opacity: 0.2;
  38.   background: #000;
  39.   visibility: hidden;
  40. }
  41.  
  42. .imgsrc {
  43.   position: absolute;
  44.   width: 250px;
  45.   height: 140px;
  46.   visibility: hidden;
  47.   margin: 4%;
  48. }
  49.  
  50. #bkgcaption {
  51.   position: absolute;
  52.   bottom: 0px;
  53.   left: 0px;
  54.   width: 100%;
  55.   height: 6%;
  56.   background:#1a1a1a;
  57. }
  58. #caption {
  59.   position: absolute;
  60.   font-family: arial, helvetica, verdana, sans-serif;
  61.   white-space: nowrap;
  62.   color: #fff;
  63.   bottom: 0px;
  64.   width: 100%;
  65.   left: -10000px;
  66.   text-align: center;
  67. }

JavaScript

在页面底部,标签之前使用下面的代码来初始化该图片画廊特效。

  1. function dom_onload() {
  2.     if(document.getElementById("diapoContainer")) diapo.init(); else setTimeout("dom_onload();", 128);
  3.   }
  4.   dom_onload();

弹性效果的图片展示画廊特效

已有 390 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!