幻灯片/轮播

网格切换旋转木马特效jQuery插件

阿里云


grid-to-carousel.js 是一款可以将 Bootstrap 网格转换为旋转木马特效的 jQuery 插件。通过该 jQuery 插件,可以将指定的网格内容扩展为旋转木马效果,通过前后导航按钮来轮流播放。

使用方法:

在页面中引入 bootstrap 相关文件,jquery 和 grid-to-carousel.js 文件。

也想出现在这里?联系我们
创客主机
  1. <link rel="stylesheet" href="path/to/bootstrap.min.css">
  2. <script src="path/to/jquery.js"></script>
  3. <script src="path/to/bootstrap.min.js"></script>
  4. <script src="path/to/grid-to-carousel.js"></script>

HTML 结构:

grid-to-carousel.js 使用下面的基本 HTML 结构。

  1. <div class="features-container">
  2.   <div id="carousel-example-generic" class="hidden carousel slide" data-ride="carousel">
  3.       <!-- 圆点导航 -->
  4.       <ol class="carousel-indicators">
  5.           <li data-target="#carousel-example-generic" data-slide-to="0"></li>
  6.           <li data-target="#carousel-example-generic" data-slide-to="1"></li>
  7.           <li data-target="#carousel-example-generic" data-slide-to="2"></li>
  8.           <li data-target="#carousel-example-generic" data-slide-to="3"></li>
  9.           <li data-target="#carousel-example-generic" data-slide-to="4"></li>
  10.           <li data-target="#carousel-example-generic" data-slide-to="5"></li>
  11.       </ol>
  12.  
  13.       <!-- 旋转木马包裹容器 -->
  14.       <div class="carousel-inner" role="listbox">
  15.           <div class="item">
  16.               <div class="content content-green">
  17.                   <span class="close-btn"></span>
  18.                   <img class="feature-img" src="img/feature-img.jpg">
  19.                   <h2>Designed for your whole team, not just designers</h2>
  20.                   <p>
  21.                       <strong>CreativeCMS</strong> offers your whole team access as required to templates, code
  22.                       <span class="highlight-yellow">(HTML, CSS, JavaScript)</span>, fonts and images, providing
  23.                       unlimited scope to extend the default range of components <span class="highlight-yellow">
  24.                       (Blog, Case studies and all.)</span> to fit the bespoke needs of any client.
  25.                   </p>
  26.               </div>
  27.           </div>
  28.           <div class="item">
  29.               <div class="content content-yellow">
  30.                   <span class="close-btn"></span>
  31.                   <h2>A modern CMS</h2>
  32.                   <p>A platform built for the modern business.</p>
  33.               </div>
  34.           </div>
  35.           <div class="item">
  36.               <div class="content content-white">
  37.                   <span class="close-btn"></span>
  38.                   <h2>One United Team</h2>
  39.                   <p>Designed for your whole team, not just designers.</p>
  40.               </div>
  41.           </div>
  42.           <div class="item">
  43.               <div class="content content-grey">
  44.                   <span class="close-btn"></span>
  45.                   <h2>Nimble  Lively</h2>
  46.                   <p>New websites up and running in seconds.</p>
  47.               </div>
  48.           </div>
  49.           <div class="item">
  50.               <div class="content content-red">
  51.                   <span class="close-btn"></span>
  52.                   <h2>Bright Content</h2>
  53.                   <p>A proven CMS to support your success.</p>
  54.               </div>
  55.           </div>
  56.           <div class="item">
  57.               <div class="content content-white-green">
  58.                   <span class="close-btn"></span>
  59.                   <h2>Work Efficiently</h2>
  60.                   <p>Benefit from regular upgrades without disruption.</p>
  61.               </div>
  62.           </div>
  63.       </div>
  64.  
  65.       <!-- 前后导航按钮 -->
  66.       <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
  67.           <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
  68.           <span class="sr-only">Previous</span>
  69.       </a>
  70.       <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
  71.           <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
  72.           <span class="sr-only">Next</span>
  73.       </a>
  74.   </div>
  75.  
  76.   <div class="grid">
  77.       <div class="row">
  78.           <div class="col-xs-4 col-md-3">
  79.               <div class="content content-green">
  80.                   <h2>One Central Location</h2>
  81.                   <p>Easily manage your client base.</p>
  82.               </div>
  83.           </div>
  84.           <div class="col-xs-4 col-md-3">
  85.               <div class="content content-yellow">
  86.                   <h2>A modern CMS</h2>
  87.                   <p>A platform built for the modern business.</p>
  88.               </div>
  89.           </div>
  90.           <div class="col-xs-4 col-md-6">
  91.               <div class="content content-white">
  92.                   <img src="img/united-icon.png" alt="">
  93.                   <h2>One United Team</h2>
  94.                   <p>Designed for your whole team, not just designers.</p>
  95.               </div>
  96.           </div>
  97.       </div>
  98.       <div class="row">
  99.           <div class="col-xs-4 col-md-6">
  100.               <div class="content content-grey">
  101.                   <img src="img/browser-icon.jpg" alt="">
  102.                   <h2>Nimble  Lively</h2>
  103.                   <p>New websites up and running in seconds.</p>
  104.               </div>
  105.           </div>
  106.           <div class="col-xs-4 col-md-3">
  107.               <div class="content content-red">
  108.                   <h2>Bright Content</h2>
  109.                   <p>A proven CMS to support your success.</p>
  110.               </div>
  111.           </div>
  112.           <div class="col-xs-4 col-md-3">
  113.               <div class="content content-white-green">
  114.                   <h2>Work Efficiently</h2>
  115.                   <p>Benefit from regular upgrades without disruption.</p>
  116.               </div>
  117.           </div>
  118.       </div>
  119.   </div>
  120. </div>

初始化插件:

在页面 DOM 元素加载完毕之后,可以通过 gridToCarousel()方法来初始化该旋转木马插件。

  1. $(function() {
  2.     $('.features-container').gridToCarousel();
  3. });

Github 地址:https://github.com/nicholaswright/grid-to-carousel

网格切换旋转木马特效 jQuery 插件

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

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

发表回复

热销模板

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

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