<html>
其中用到了bootstrap的图片处理,响应式图片属性img-responsive,和图片形状,img-thumbnail
写成 class="img-responsive img-thumbnail"
然后fancybox直接用默认 $("a.grouped_elements").fancybox();
$()这里的是选择器。
<head>
<title>
</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="source/jquery.fancybox.css?v=2.1.5" media="screen" />
<!-- Add jQuery library -->
<script type="text/javascript" src="lib/jquery-1.10.1.min.js"></script>
<!-- Add mousewheel plugin (this is optional) -->
<script type="text/javascript" src="lib/jquery.mousewheel-3.0.6.pack.js"></script>
<!-- Add fancyBox main JS and CSS files -->
<script type="text/javascript" src="source/jquery.fancybox.js?v=2.1.5"></script>
<!-- Add Media helper (this is optional) -->
<!-- 新 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
<script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
/* 最基本的,使用了默认配置 */
$("a.grouped_elements").fancybox();
/* 使用了自定义配置 */
/* 一下配置支持组播放 */
// $("a.grouped_elements").fancybox({
// 'cyclic' : 'false',
// 'titleShow' : 'false'
// });
}); </script>
<p>
<table>
<tr>
<td><a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213505.jpg_1080x.jpg" title="title1" ><img src="https://cache.tdyun.com/upload/information/20200311/55/213505.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td><td>
<a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213522.jpg_1080x.jpg" title="title2"><img src="https://cache.tdyun.com/upload/information/20200311/55/213522.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td>
</tr>
<tr> <td><a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213524.jpg_1080x.jpg" title="title3"><img src="https://cache.tdyun.com/upload/information/20200311/55/213524.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td><td>
<a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213526.jpg_1080x.jpg" title="title4"><img src="https://cache.tdyun.com/upload/information/20200311/55/213526.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td> </tr>
<tr> <td><a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213540.jpg_1080x.jpg" title="title5"><img src="https://cache.tdyun.com/upload/information/20200311/55/213540.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td><td>
<a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213541.jpg_1080x.jpg" title="title6"><img src="https://cache.tdyun.com/upload/information/20200311/55/213541.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td> </tr>
<tr> <td><a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213542.jpg_1080x.jpg" title="title7"><img src="https://cache.tdyun.com/upload/information/20200311/55/213542.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td><td>
<a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213543.jpg_1080x.jpg" title="title8"><img src="https://cache.tdyun.com/upload/information/20200311/55/213543.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td> </tr>
<tr> <td><a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213551.jpg_1080x.jpg" title="title91"><img src="https://cache.tdyun.com/upload/information/20200311/55/213551.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td><td>
<a class="grouped_elements" rel="group1" href="https://cache.tdyun.com/upload/information/20200311/55/213552.jpg_1080x.jpg" title="title10"><img src="https://cache.tdyun.com/upload/information/20200311/55/213552.jpg_720x.jpg" alt="" class="img-responsive img-thumbnail"></a> </td> </tr>
</table>
</p>
</body>
</html>
参考文档:http://blog.csdn.net/china_skag/article/details/23882281
http://v3.bootcss.com/css/#p_w_picpaths-responsive