响应式jQuery等高照片库插件 Pycs布局

  • 源码大小:194.83KB
  • 所需积分:1积分
  • 源码编号:19JP-3103
  • 浏览次数:995次
  • 最后更新:2023年05月06日
  • 所属栏目:布局
本站默认解压密码:19jp.com 或 19jp_com

简介

Pycs Layout是一个jQuery插件,用于创建响应迅速、紧凑的图像布局/库,通过保留图像的纵横比和填充最大空间来分发图像

基本用法:

1.在页面中包含jQuery javascript库和jQuery Pycs布局插件。

  1. <script src="/path/to/cdn/jquery.min.js"></script>
  2. <script src="/path/to/js/pycs-layout.jquery.js"></script>

2.在页面中包含其他必要的javascript文件。

  1. <script src="js/modernizr.min.js"></script>
  2. <script src="js/foundation.min.js"></script>

3.按照标记结构创建图像布局/库:

  1. <div class="photos-gallery">
  2. <div class="picture"> <img src="assets/pictures/1.jpg" /> </div>
  3. <div class="picture"> <img src="assets/pictures/2.jpg" /> </div>
  4. <div class="picture"> <img src="assets/pictures/3.jpg" /> </div>
  5.  
  6. ...
  7. </div>

4.在加载的页面上初始化插件。

  1. $(window).load( function() {
  2. $(".photos-gallery").pycsLayout({
  3. gutter: 4,
  4. idealHeight: parseInt($(window).height()/2)
  5. });

5.所有默认设置。

  1. $(".photos-gallery").pycsLayout({
  2.  
  3. /* the class of the elements we want to layout. */
  4. pictureContainer: ".picture",
  5.  
  6. /* the height we want our elements to have. */
  7. idealHeight: 150,
  8.  
  9. /* the horizontal and vertical margin between the elements (in px). */
  10. gutter: 6,
  11. });

更新日志:

2023-04-04

  • jQuery 3.6的更新+

预览截图