瀑布流

兼容IE8瀑布流布局jQuery插件

阿里云

Pinterest Grid 是一款仿 Pinterest 网站的响应式网格瀑布流布局 jQuery 插件。该瀑布流插件使用简单,可以随父容器的大小自动调节网格布局,并且支持 IE8+的 IE 浏览器。

使用方法:

  1. //使用该瀑布流插件需要引入jQuery和pinterest_grid.js文件。
  2. <script src="js/jquery.min.js"></script>
  3. <script src="js/pinterest_grid.js"></script>
也想出现在这里?联系我们
创客主机

HTML 结构:

  1. //该jQuery瀑布流布局插件使用下面的HTML结构。
  2. <section id="demo">
  3.   <article class="white-panel"> 
  4.     <img src="1.jpg" alt="...">
  5.     <h1><a href="#">Title 1</a></h1>
  6.     <p>Description 1</p>
  7.   </article>
  8.  
  9.   <article class="white-panel"> 
  10.     <img src="2.jpg" alt="...">
  11.     <h1><a href="#">Title 2</a></h1>
  12.     <p>Description 2</p>
  13.   </article>
  14.  
  15.   <article class="white-panel"> 
  16.     <img src="3.jpg" alt="...">
  17.     <h1><a href="#">Title 3</a></h1>
  18.     <p>Description 3</p>
  19.   </article>
  20.   ...
  21. </section>

CSS 样式:

  1. //你需要为该瀑布流布局添加下面的一些必要的CSS样式。
  2. #gallery-wrapper {
  3.   position: relative;
  4.   max-width: 100%;
  5.   width: 100%;
  6. }
  7. img.thumb {
  8.   width: 100%;
  9.   max-width: 100%;
  10.   height: auto;
  11. }
  12. .white-panel {
  13.   position: absolute;
  14.   background: white;
  15.   border-radius: 5px;
  16.   box-shadow: 0px 1px 2px rgba(0,0,0,0.3);
  17.   padding: 10px;
  18. }
  19. .white-panel h1 {
  20.   font-size: 1em;
  21. }
  22. .white-panel h1 a {
  23.   color: #A92733;
  24. }
  25. .white-panel:hover {
  26.   box-shadow: 1px 1px 10px rgba(0,0,0,0.5);
  27.   margin-top: -5px;
  28.   -webkit-transition: all 0.3s ease-in-out;
  29.   -moz-transition: all 0.3s ease-in-out;
  30.   -o-transition: all 0.3s ease-in-out;
  31.   transition: all 0.3s ease-in-out;
  32. }

初始化插件:

  1. /* 在页面DOM元素加载完毕之后,可以通过pinterest_grid()方法来初始化该瀑布流布局插件 */
  2. $("#gallery-wrapper").pinterest_grid();

配置参数:

该瀑布流布局插件有以下一些可用的配置参数。
no_columns:网格布局一行的列数。默认值为一行 3 个网格。
padding_x:网格在 X 轴方向的 padding 值。默认值为 10 像素。
padding_y:网格在 Y 轴方向的 padding 值。默认值为 10 像素。
margin_bottom:网格底部的 margin 值。默认值为 50 像素。
single_column_breakpoint:指定在视口多大时一行只显示一个网格。

兼容 IE8 瀑布流布局 jQuery 插件

已有 378 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!