jQuery siteslider 动画幻灯片

在线实例

效果一 效果二

使用方法

  1. <div class="container demo-1">
  2.             <div id="slider" class="sl-slider-wrapper">
  3.                 <div class="sl-slider">
  4.                     <div class="sl-slide bg-1" data-orientation="horizontal" data-slice1-rotation="-25" data-slice2-rotation="-25" data-slice1-scale="2" data-slice2-scale="2">
  5.                         <div class="sl-slide-inner">
  6.                             <div class="deco" data-icon="H"></div>
  7.                             <h2>A bene placito</h2>
  8.                             <blockquote><p>You have just dined, and however scrupulously the slaughterhouse is concealed in the graceful distance of miles, there is complicity.</p><cite>Ralph Waldo Emerson</cite></blockquote>
  9.                         </div>
  10.                     </div>
  11.  
  12.                     <div class="sl-slide bg-2" data-orientation="vertical" data-slice1-rotation="10" data-slice2-rotation="-15" data-slice1-scale="1.5" data-slice2-scale="1.5">
  13.                         <div class="sl-slide-inner">
  14.                             <div class="deco" data-icon="q"></div>
  15.                             <h2>Regula aurea</h2>
  16.                             <blockquote><p>Until he extends the circle of his compassion to all living things, man will not himself find peace.</p><cite>Albert Schweitzer</cite></blockquote>
  17.                         </div>
  18.                     </div>
  19.  
  20.                     <div class="sl-slide bg-3" data-orientation="horizontal" data-slice1-rotation="3" data-slice2-rotation="3" data-slice1-scale="2" data-slice2-scale="1">
  21.                         <div class="sl-slide-inner">
  22.                             <div class="deco" data-icon="O"></div>
  23.                             <h2>Dum spiro, spero</h2>
  24.                             <blockquote><p>Thousands of people who say they 'love' animals sit down once or twice a day to enjoy the flesh of creatures who have been utterly deprived of everything that could make their lives worth living and who endured the awful suffering and the terror of the abattoirs.</p><cite>Dame Jane Morris Goodall</cite></blockquote>
  25.                         </div>
  26.                     </div>
  27.  
  28.                     <div class="sl-slide bg-4" data-orientation="vertical" data-slice1-rotation="-5" data-slice2-rotation="25" data-slice1-scale="2" data-slice2-scale="1">
  29.                         <div class="sl-slide-inner">
  30.                             <div class="deco" data-icon="I"></div>
  31.                             <h2>Donna nobis pacem</h2>
  32.                             <blockquote><p>The human body has no more need for cows' milk than it does for dogs' milk, horses' milk, or giraffes' milk.</p><cite>Michael Klaper M.D.</cite></blockquote>
  33.                         </div>
  34.                     </div>
  35.  
  36.                     <div class="sl-slide bg-5" data-orientation="horizontal" data-slice1-rotation="-5" data-slice2-rotation="10" data-slice1-scale="2" data-slice2-scale="1">
  37.                         <div class="sl-slide-inner">
  38.                             <div class="deco" data-icon="t"></div>
  39.                             <h2>Acta Non Verba</h2>
  40.                             <blockquote><p>I think if you want to eat more meat you should kill it yourself and eat it raw so that you are not blinded by the hypocrisy of having it processed for you.</p><cite>Margi Clarke</cite></blockquote>
  41.                         </div>
  42.                     </div>
  43.                 </div><!-- /sl-slider -->
  44.  
  45.                 <nav id="nav-arrows" class="nav-arrows">
  46.                     <span class="nav-arrow-prev">Previous</span>
  47.                     <span class="nav-arrow-next">Next</span>
  48.                 </nav>
  49.  
  50.                 <nav id="nav-dots" class="nav-dots">
  51.                     <span class="nav-dot-current"></span>
  52.                     <span></span>
  53.                     <span></span>
  54.                     <span></span>
  55.                     <span></span>
  56.                 </nav>
  57.  
  58.             </div><!-- /slider-wrapper -->
  59.  
  60.         </div>
  61.         <script type="text/javascript" src="http://libs.useso.com/js/jquery/1.8.2/jquery.min.js"></script>
  62.         <script type="text/javascript" src="/api/jq/5733e3636bc3e/js/jquery.ba-cond.min.js"></script>
  63.         <script type="text/javascript" src="/api/jq/5733e3636bc3e/js/jquery.slitslider.js"></script>
  64.         <script type="text/javascript">
  65.             $(function() {
  66.  
  67.                 var Page = (function() {
  68.  
  69.                     var $navArrows = $('#nav-arrows'),
  70.                             $nav = $('#nav-dots > span'),
  71.                             slitslider = $('#slider').slitslider({
  72.                         onBeforeChange: function(slide, pos) {
  73.  
  74.                             $nav.removeClass('nav-dot-current');
  75.                             $nav.eq(pos).addClass('nav-dot-current');
  76.  
  77.                         }
  78.                     }),
  79.                             init = function() {
  80.  
  81.                                 initEvents();
  82.  
  83.                             },
  84.                             initEvents = function() {
  85.  
  86.                                 // add navigation events
  87.                                 $navArrows.children(':last').on('click', function() {
  88.  
  89.                                     slitslider.next();
  90.                                     return false;
  91.  
  92.                                 });
  93.  
  94.                                 $navArrows.children(':first').on('click', function() {
  95.  
  96.                                     slitslider.previous();
  97.                                     return false;
  98.  
  99.                                 });
  100.  
  101.                                 $nav.each(function(i) {
  102.  
  103.                                     $(this).on('click', function(event) {
  104.  
  105.                                         var $dot = $(this);
  106.  
  107.                                         if (!slitslider.isActive()) {
  108.  
  109.                                             $nav.removeClass('nav-dot-current');
  110.                                             $dot.addClass('nav-dot-current');
  111.  
  112.                                         }
  113.  
  114.                                         slitslider.jump(+ 1);
  115.                                         return false;
  116.  
  117.                                     });
  118.  
  119.                                 });
  120.  
  121.                             };
  122.  
  123.                     return {init: init};
  124.  
  125.                 })();
  126.  
  127.                 Page.init();
  128.  
  129.             });
  130.         </script>
复制

猜你喜欢

转载自zaixianshouce.iteye.com/blog/2320073