1. 程式人生 > >jqthumb.js縮圖外掛-縮圖正常顯示而不變形

jqthumb.js縮圖外掛-縮圖正常顯示而不變形

<!doctype html> <html class="no-js"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>上傳圖片</title> <meta name="description" content=""> <meta name="keywords" content="gallery"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="renderer" content="webkit"> <meta http-equiv="Cache-Control" content="no-siteapp" /> <link rel="icon" type="image/png" href="themes/images/favicon.ico"> <link rel="apple-touch-icon-precomposed" href=""> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-title" content="Amaze UI" /> <link rel="stylesheet" href="themes/amaze1.0.0/amazeui.min.css"/> <link rel="stylesheet" href="themes/amaze1.0.0/font-awesome.css"/> <style type="text/css"> .zn-uploadphotos-list img{ width: 100%; height: 100%; } </style> </head> <body> <ul class="zn-uploadphotos-list am-gallery am-avg-sm-2 am-avg-md-4 am-avg-lg-8 am-gallery-default am-no-layout" id="Gallery"> <li> <img src="uploads/img2.jpg" alt="圖片1"> </li> <li> <img src="uploads/img3.jpg" alt="圖片1"> </li> <li> <img src="uploads/img6.jpg" alt="圖片1"> </li> </ul> <!--[if lt IE 9]> <script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script> <script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script> <script src="themes/amaze1.0.0/amazeui.ie8polyfill.min.js"></script> <![endif]--> <!--[if (gte IE 9)|!(IE)]><!--> <script type="text/javascript" src="themes/js/jquery-1.7.2.min.js"></script> <!--<![endif]--> <script type="text/javascript" src="themes/amaze1.0.0/amazeui.min.js"></script> <script type="text/javascript" src="themes/js/jqthumb.js"></script> <script type="text/javascript"> $(function(){ images(); $(window).resize(function () { images(); }) }); function images(){ var imgWidth=$('#Gallery>li').width(); $('#Gallery img').jqthumb({ classname : 'jqthumb', width : imgWidth, height : imgWidth, showoncomplete : true }); } </script> </body> </html>