読者です 読者をやめる 読者になる 読者になる

Webデザインの勉強 ハロートレーニング 受講生のためのWebデザインの勉強補足ブログ

FlexSlider 2

ルーセル

<!DOCTYPE html>
<html lang="ja">
<head>
<meta content="charset=utf-8">
<title>FlexSlider 2</title>
<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
<link rel="stylesheet" href="css/flexslider.css">
<link rel="stylesheet" href="css/demo.css">
</head>
<body class="loading">
<div id="container">
<header>
<h1>FlexSlider 2</h1>
</header>
<section class="slider">
<div class="flexslider carousel">
<ul class="slides">
<li><img src="img/kitchen_adventurer_cheesecake_brownie.jpg"></li>
<li><img src="img/kitchen_adventurer_lemon.jpg"></li>
<li><img src="img/kitchen_adventurer_donut.jpg"></li>
<li><img src="img/kitchen_adventurer_caramel.jpg"></li>
<li><img src="img/kitchen_adventurer_cheesecake_brownie.jpg"></li>
<li><img src="img/kitchen_adventurer_lemon.jpg"></li>
<li><img src="img/kitchen_adventurer_donut.jpg"></li>
<li><img src="img/kitchen_adventurer_caramel.jpg"></li>
<li><img src="img/kitchen_adventurer_cheesecake_brownie.jpg"></li>
<li><img src="img/kitchen_adventurer_lemon.jpg"></li>
<li><img src="img/kitchen_adventurer_donut.jpg"></li>
<li><img src="img/kitchen_adventurer_caramel.jpg"></li>
</ul>
</div>
</section>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script>
<script defer src="js/jquery.flexslider.js"></script>
<script type="text/javascript">
  (function() {

    // store the slider in a local variable
    var $window = $(window),
        flexslider;

    // tiny helper function to add breakpoints
    function getGridSize() {
      return (window.innerWidth < 600) ? 2 :
             (window.innerWidth < 900) ? 3 : 4;
    }

    $window.load(function() {
      $('.flexslider').flexslider({
        animation: "slide",
        animationSpeed: 400,
        animationLoop: false,
        itemWidth: 210,
        itemMargin: 5,
        minItems: getGridSize(), // use function to pull in initial value
        maxItems: getGridSize(), // use function to pull in initial value
        start: function(slider){
          $('body').removeClass('loading');
          flexslider = slider;
        }
      });
    });

    // check grid size on resize event
    $window.resize(function() {
      var gridSize = getGridSize();

      flexslider.vars.minItems = gridSize;
      flexslider.vars.maxItems = gridSize;
    });
  }());
</script>

<!-- Optional FlexSlider Additions -->
<script src="js/jquery.easing.js"></script>
<script src="js/jquery.mousewheel.js"></script>
<script defer src="js/demo.js"></script>
</body>
</html>


広告を非表示にする