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

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

Slider

SLIDERJS

  • SlidesJS 3.0


<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>SlidesJS Standard Code Example</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="css/example.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<style>
body {
  -webkit-font-smoothing: antialiased;
  font: normal 15px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: #232525;
  padding-top:70px;
}

#slides {
  display: none
}

#slides .slidesjs-navigation {
  margin-top:5px;
}

a.slidesjs-next,
a.slidesjs-previous,
a.slidesjs-play,
a.slidesjs-stop {
  background-image: url(img/btns-next-prev.png);
  background-repeat: no-repeat;
  display:block;
  width:12px;
  height:18px;
  overflow: hidden;
  text-indent: -9999px;
  float: left;
  margin-right:5px;
}

a.slidesjs-next {
  margin-right:10px;
  background-position: -12px 0;
}

a:hover.slidesjs-next {
  background-position: -12px -18px;
}

a.slidesjs-previous {
  background-position: 0 0;
}

a:hover.slidesjs-previous {
  background-position: 0 -18px;
}

a.slidesjs-play {
  width:15px;
  background-position: -25px 0;
}

a:hover.slidesjs-play {
  background-position: -25px -18px;
}

a.slidesjs-stop {
  width:18px;
  background-position: -41px 0;
}

a:hover.slidesjs-stop {
  background-position: -41px -18px;
}

.slidesjs-pagination {
  margin: 7px 0 0;
  float: right;
  list-style: none;
}

.slidesjs-pagination li {
  float: left;
  margin: 0 1px;
}

.slidesjs-pagination li a {
  display: block;
  width: 13px;
  height: 0;
  padding-top: 13px;
  background-image: url(img/pagination.png);
  background-position: 0 0;
  float: left;
  overflow: hidden;
}

.slidesjs-pagination li a.active,
.slidesjs-pagination li a:hover.active {
  background-position: 0 -13px
}

.slidesjs-pagination li a:hover {
  background-position: 0 -26px
}

#slides a:link,
#slides a:visited {
  color: #333
}

#slides a:hover,
#slides a:active {
  color: #9e2020
}

.navbar {
  overflow: hidden
}
</style>

<style>
#slides {
  display: none
}

.container {
  margin: 0 auto
}

/* For tablets & smart phones */
@media (max-width: 767px) {
  body {
    padding-left: 20px;
    padding-right: 20px;
  }
  .container {
    width: auto
  }
}

/* For smartphones */
@media (max-width: 480px) {
  .container {
    width: auto
  }
}

/* For smaller displays like laptops */
@media (min-width: 768px) and (max-width: 979px) {
  .container {
    width: 724px
  }
}

/* For larger displays */
@media (min-width: 1200px) {
  .container {
    width: 1170px
  }
}
</style>
</head>
<body>
<div class="container">
<div id="slides">
  <img src="img/example-slide-1.jpg" alt="">
  <img src="img/example-slide-2.jpg" alt="">
  <img src="img/example-slide-3.jpg" alt="">
  <img src="img/example-slide-4.jpg" alt="">
</div>
</div>

<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="js/jquery.slides.min.js"></script>

<script>
$(function() {
  $('#slides').slidesjs({
    width: 940,
    height: 528,
    play: {
      active: true,
      auto: true,
      interval: 4000,
      swap: true
    }
  });
});
</script>

</body>
</html>

Flexslider

<!DOCTYPE html>
<html lang="ja">
<head>
<meta 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;">

<!-- Demo CSS -->
<link rel="stylesheet" href="css/demo.css" type="text/css">
<link rel="stylesheet" href="css/flexslider.css" type="text/css">

</head>
<body>

<div id="container" class="cf">
<div id="main" role="main">
<section class="slider">
<div class="flexslider carousel">
<ul class="slides">
<li>
<img src="images/kitchen_adventurer_cheesecake_brownie.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_lemon.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_donut.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_caramel.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_cheesecake_brownie.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_lemon.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_donut.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_caramel.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_cheesecake_brownie.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_lemon.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_donut.jpg">
</li>
<li>
<img src="images/kitchen_adventurer_caramel.jpg">
</li>
</ul>
</div>
</section>
</div>

</div>

<!-- jQuery -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/libs/jquery-1.7.min.js">\x3C/script>')</script>

<!-- FlexSlider -->
<script defer src="../jquery.flexslider.js"></script>

<script type="text/javascript">
$(function(){
SyntaxHighlighter.all();
});
$(window).load(function(){
$('.flexslider').flexslider({
animation: "slide",
animationLoop: false,
itemWidth: 210,
itemMargin: 5,
minItems: 2,
maxItems: 4,
start: function(slider){
$('body').removeClass('loading');
}
});
});
</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>


bxSlider

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>bxSlider</title>
<link rel="stylesheet" href="css/jquery.bxslider.css">
<link rel="stylesheet" href="css/styles.css">
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<![endif]-->
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="js/jquery.bxslider.js"></script>
</head>
<body>
<div class="inner clearfix">
<div id="primary">
<script>
$(document).ready(function(){
  $('#slider2').bxSlider({
    auto: true,
    autoControls: true,
    pause: 3000,
    slideMargin: 20
  });
});
</script>
<h1>Multiple slideshows</h1>
<h3>Slideshow 2</h3>
<ul id="slider2">
<li><img src="img/01.jpg" /></li>
<li><img src="img/02.jpg" /></li>
<li><img src="img/03.jpg" /></li>
</ul>
</div><!-- /#primary -->
</div>
</body>
</html>

swiper

  • スワイプ操作に対応したイメージスライダーを実装するスクリプト


広告を非表示にする