温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

非常简单的使用jquery fancybox插件实现的查看图片效果

发布时间:2020-06-20 19:05:53 来源:网络 阅读:362 作者:雷顿学院 栏目:web开发
<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.yisu.com/upload/information/20200311/55/213505.jpg_1080x.jpg" title="title1" ><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213522.jpg_1080x.jpg" title="title2"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213524.jpg_1080x.jpg" title="title3"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213526.jpg_1080x.jpg" title="title4"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213540.jpg_1080x.jpg" title="title5"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213541.jpg_1080x.jpg" title="title6"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213542.jpg_1080x.jpg" title="title7"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213543.jpg_1080x.jpg" title="title8"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213551.jpg_1080x.jpg" title="title91"><img src="https://cache.yisu.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.yisu.com/upload/information/20200311/55/213552.jpg_1080x.jpg" title="title10"><img src="https://cache.yisu.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


向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI