MUI之图片预览(zoom.js和previewimage.js)



  1 <style type="text/css">
  2     .mui-preview-image.mui-fullscreen {
  3         position: fixed;
  4         z-index: 20;
  5         background-color: #000;
  6     }
  7     .mui-preview-header,
  8     .mui-preview-footer {
  9         position: absolute;
 10         width: 100%;
 11         left: 0;
 12         z-index: 10;
 13     }
 14     .mui-preview-header {
 15         height: 44px;
 16         top: 0;
 17     }
 18     .mui-preview-footer {
 19         height: 50px;
 20         bottom: 0px;
 21     }
 22     .mui-preview-header .mui-preview-indicator {
 23         display: block;
 24         line-height: 25px;
 25         color: #fff;
 26         text-align: center;
 27         margin: 15px auto 4;
 28         width: 70px;
 29         background-color: rgba(0, 0, 0, 0.4);
 30         border-radius: 12px;
 31         font-size: 16px;
 32     }
 33     .mui-preview-image {
 34         display: none;
 35         -webkit-animation-duration: 0.5s;
 36         animation-duration: 0.5s;
 37         -webkit-animation-fill-mode: both;
 38         animation-fill-mode: both;
 39     }
 40     .mui-preview-image.mui-preview-in {
 41         -webkit-animation-name: fadeIn;
 42         animation-name: fadeIn;
 43     }
 44     .mui-preview-image.mui-preview-out {
 45         background: none;
 46         -webkit-animation-name: fadeOut;
 47         animation-name: fadeOut;
 48     }
 49     .mui-preview-image.mui-preview-out .mui-preview-header,
 50     .mui-preview-image.mui-preview-out .mui-preview-footer {
 51         display: none;
 52     }
 53     .mui-zoom-scroller {
 54         position: absolute;
 55         display: -webkit-box;
 56         display: -webkit-flex;
 57         display: flex;
 58         -webkit-box-align: center;
 59         -webkit-align-items: center;
 60         align-items: center;
 61         -webkit-box-pack: center;
 62         -webkit-justify-content: center;
 63         justify-content: center;
 64         left: 0;
 65         right: 0;
 66         bottom: 0;
 67         top: 0;
 68         width: 100%;
 69         height: 100%;
 70         margin: 0;
 71         -webkit-backface-visibility: hidden;
 72     }
 73     .mui-zoom {
 74         -webkit-transform-style: preserve-3d;
 75         transform-style: preserve-3d;
 76     }
 77     .mui-slider .mui-slider-group .mui-slider-item img {
 78         width: auto;
 79         height: auto;
 80         max-width: 100%;
 81         max-height: 100%;
 82     }
 83     .mui-android-4-1 .mui-slider .mui-slider-group .mui-slider-item img {
 84         width: 100%;
 85     }
 86     .mui-android-4-1 .mui-slider.mui-preview-image .mui-slider-group .mui-slider-item {
 87         display: inline-table;
 88     }
 89     .mui-android-4-1 .mui-slider.mui-preview-image .mui-zoom-scroller img {
 90         display: table-cell;
 91         vertical-align: middle;
 92     }
 93     .mui-preview-loading {
 94         position: absolute;
 95         width: 100%;
 96         height: 100%;
 97         top: 0;
 98         left: 0;
 99         display: none;
100     }
101     .mui-preview-loading.mui-active {
102         display: block;
103     }
104     .mui-preview-loading .mui-spinner-white {
105         position: absolute;
106         top: 50%;
107         left: 50%;
108         margin-left: -25px;
109         margin-top: -25px;
110         height: 50px;
111         width: 50px;
112     }
113     .mui-preview-image img.mui-transitioning {
114         -webkit-transition: -webkit-transform 0.5s ease, opacity 0.5s ease;
115         transition: transform 0.5s ease, opacity 0.5s ease;
116     }
117     @-webkit-keyframes fadeIn {
118         0% {
119             opacity: 0;
120         }
121         100% {
122             opacity: 1;
123         }
124     }
125     @keyframes fadeIn {
126         0% {
127             opacity: 0;
128         }
129         100% {
130             opacity: 1;
131         }
132     }
133     @-webkit-keyframes fadeOut {
134         0% {
135             opacity: 1;
136         }
137         100% {
138             opacity: 0;
139         }
140     }
141     @keyframes fadeOut {
142         0% {
143             opacity: 1;
144         }
145         100% {
146             opacity: 0;
147         }
148     }
149     p img {
150         max-width: 100%;
151         height: auto;
152     }
153 </style>  


1 <ul>
2     <li><img class="file-pic" data-preview-src="" data-preview-group="1" src="../../ydzh.imgs/entry/ban1.png"/></li>
3     <li><img class="file-pic" data-preview-src="" data-preview-group="1" src="../../ydzh.imgs/entry/img_ban.png"/></li>
4     <li><img class="file-pic" data-preview-src="" data-preview-group="1" src="../../ydzh.imgs/entry/img_ban.png"/></li>
5 </ul>  
1 <script src="../../mui.frame/js/mui.min.js"></script>
2 <script src="../../mui.frame/js/mui.zoom.js"></script>
3 <script src="../../mui.frame/js/mui.previewimage.js"></script>
4 <script>
5     mui.previewImage();
6 </script>
    
时间: 2024-10-29 14:01:56

MUI之图片预览(zoom.js和previewimage.js)的相关文章

JS实现的图片预览功能

之前的博文有实现过图片上传预览,但那种方法是预览时就将图片上传,会产生很大的浪费空间.找到了之前有人写的用JS实现的图片预览,就说用js将上传的图片显示,上传代码在之前的博文中有写到. 以下是实现的代码: body: <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td heig

dwz+jquery+fileupload+springmvc实现文件上传 及图片预览

1 前台jsp:文件的上传利用了iframe实现局部刷新功能.使用了apache的fileupload组件,用到的jar: commons-fileupload.jar,commons-io.jarDiskFileItemFactory fac = new DiskFileItemFactory();ServletFileUpload upload = new ServletFileUpload(fac);upload.setHeaderEncoding("utf-8"); Html代

兼容ie[6-9]、火狐、Chrome、opera、maxthon3、360浏览器的js本地图片预览

html代码: <div id="divPreview"> <img id="imgHeadPhoto" src="Images/Headphoto/noperson.jpg" style="width: 160px; height: 170px;border: solid 1px #d2e2e2;" alt="" /> </div> <asp:FileUpload

JS魔法堂之实战:纯前端的图片预览

一.前言 图片上传是一个普通不过的功能,而图片预览就是就是上传功能中必不可少的子功能了.在这之前,我曾经通过订阅input[type=file]元素的onchange事件,一旦更改路径则将图片上传至服务器,接着就获取图片路径并赋值到img元素上.先不管文件异步提交的解决方案,就是服务端清理那些临时的预览图片已经增加不少工作量了. 偶然从MDN上找到纯前端图片预览的相关资料,经过整理后记录下来以便日后查阅. 二.准备功夫1──FileReader FileReader是HTML5的新特性,用于读取

常用js,解决 textarea换行,图片预览,等待加载

/** 解决在textarea中输入的数据存入数据库后读到页面没有换行效果* textarea_info是显示在页面内容区域的class* 使用方法:直接在相应的区域加上class="textarea_info"* 在js中调用textarea_br()即可* */    function textarea_br(){        var element = $(".textarea_info");        element.each(function(){ 

利用js加载本地图片预览功能

直接上代码: 经测试,除safari6包括6以下不支持,其他均可正常显示. 原因:safari6不支持filereader,同时不能使用IE滤镜导致失效. fix: 可以利用canvas,解决safari6的问题 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

js本地图片预览代码兼容所有浏览器

html代码 <div id="divPreview" style="width: 160px; height: 170px"><img id="imgHeadPhoto" src="www.niyuewo.com" style="width: 160px; height: 170px;border: solid 1px #d2e2e2;" /> </div> <a

js本地图片预览,兼容ie[6-9]、火狐、Chrome17+、Opera11+、Maxthon3

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title></title> </head> <body> <div id="divPrevie

js实现移动端图片预览:手势缩放, 手势拖动,双击放大...

.katex { display: block; text-align: center; white-space: nowrap; } .katex-display > .katex > .katex-html { display: block; } .katex-display > .katex > .katex-html > .tag { position: absolute; right: 0px; } .katex { font-style: normal; font