複数画像移動型

スライダー

(スライドショー無し)

HTML

<!-- 左側カラム -->
<div id="leftcolomn">
	<h4 style="text-align:center;">複数画像移動型</h4>
	<h3 style="text-align:center;">スライダー</h3>
	<h4 style="text-align:center;">(スライドショー無し)</h4>
</div>
<!-- スライダー部 -->
<div id="stage">
	<input type="radio" id="b2" name="sld">
	<input type="radio" id="b3" name="sld">
	<input type="radio" id="b4" name="sld">
	<input type="radio" id="f5" name="sld">
	<input type="radio" id="f6" name="sld">
	<input type="radio" id="f7" name="sld">
	<input id="r1" type="radio" name="sld">
	<input id="r2" type="radio" name="sld">
	<input id="r3" type="radio" name="sld">
	<input id="r4" type="radio" name="sld">
  <!-- スライド群と送りボタン -->
  <div id="photos">
    <div id="photo4" class="pic"><img src="img10/m4.jpg">
    	<label for="b4"><span class="left_btn"></span></label>
    </div>
    <div id="photo3" class="pic"><img src="img10/m3.jpg">
    	<label for="b3"><span class="left_btn"></span></label>
    </div>
    <div id="photo2" class="pic"><img src="img10/m2.jpg">
    	<label for="b2"><span class="left_btn"></span></label>
    </div>
  	<div id="photo1" class="pic"><img src="img10/m1.jpg">
    </div>
    <div id="photo5" class="pic"><img src="img10/m5.jpg">
    	<label for="f5"><span class="right_btn"></span></label>
    </div>
    <div id="photo6" class="pic"><img src="img10/m6.jpg">
    	<label for="f6"><span class="right_btn"></span></label>
    </div>
    <div id="photo7" class="pic"><img src="img10/m7.jpg">
    	<label for="f7"><span class="right_btn"></span></label>
    </div>
    <div id="photo8" class="pic"><img src="img10/m8.jpg">
    </div>
  </div>
  <!-- スライダー部の高さ確保 -->
  <div style="padding-top:20%;"></div>
  <!-- スライドボタン -->
  <div id="btns">
  	<label for="r1" id="btn1" class="p_bar"></label>
  	<label for="r2" id="btn2" class="p_bar"></label>
  	<label for="r3" id="btn3" class="p_bar"></label>
  	<label for="r4" id="btn4" class="p_bar"></label>
    <!-- 位置表示バー -->
    <div id="p_btn"></div>
  </div>
  <!-- ボタン部の高さ確保 -->
  <div style="padding-top:2%;"></div>

CSS

html,body { height:100%; }
/* 左側カラム(不要な時はwidth:0;) */
#leftcolomn { width:10%;height:100%;background:#ddd;float:left; }
/* スライダー部(#leftcolomnのwidth;0;の時はwidth:100%;) */
#stage {
	position: relative;
	width: 90%;
	background:#F8F2F2;
	overflow: hidden;
}
/* スライド群 */
#photos {
	position: absolute;
	width: 100%;
	left:1%;
	top:10px;
	transition:left 1s ease;
}
.pic {
	width:20%;
	position:absolute;
}
.pic img { width:94%; }
/* スライドを#photos内に水平に並べる */
#photo1 { left:0%; }
#photo2 { left:20%; }
#photo3 { left:40%; }
#photo4 { left:60%; }
#photo5 { left:80%; }
#photo6 { left:100%; }
#photo7 { left:120%; }
#photo8 { left:140%; }
/* スライドボタン・位置表示バー */
#btns { width:25%;margin:0 auto;position:relative; }
.p_bar { display:block;width:8%;height:8px;background:#aaa; }
.p_bar { position:absolute;top:8px; }
.p_bar:hover { cursor:pointer; }
#p_btn { display:block;width:8%;height:8px;background:#f00;z-index:20;position:absolute;top:8px; }

#btn1 { left:0%; }
#btn2 { left:12%; }
#btn3 { left:24%; }
#btn4 { left:36%; }
#p_btn { left:0%; transition:left 1s ease; pointer-events : none; }

#r1,#r2,#r3,#r4,#b2,#b3,#b4,#f5,#f6,#f7 { display:none; }

/* スライドボタンクリック時のスライド群のanimation設定 */
#r1:checked ~ #photos { left:1%;   }
#r2:checked ~ #photos { left:-19%; }
#r3:checked ~ #photos { left:-39%; }
#r4:checked ~ #photos { left:-59%; }
/* スライドボタンクリック時の位置表示バーのanimation設定 */
#r1:checked ~ #btns #p_btn { left:0%; }
#r2:checked ~ #btns #p_btn { left:12%; }
#r3:checked ~ #btns #p_btn { left:24%; }
#r4:checked ~ #btns #p_btn { left:36%; }

/* 戻り・送りボタン */
.left_btn,.right_btn { 	
	position:fixed;
	opacity:0;
}
.left_btn {
	display:block;width:50px;height:50px;left:12%;top:15%;background:url(images/back_1.png);
}
.left_btn:hover { background:url(images/back_2.png);cursor:pointer; }
.right_btn {
	display:block;width:50px;height:50px;right:3%;top:15%;background:url(images/forward_1.png);
}
.right_btn:hover { background:url(images/forward_2.png);cursor:pointer; }
/* 画像hoverで送り・戻りボタンを表示 */
.pic label span { pointer-events:none; }
/* スライドのhoverで該当する送りボタンを表示・アクティブ化する */
#photo1:hover > label span,#photo2:hover > label span,#photo3:hover > label span,#photo4:hover > label span,#photo5:hover > label span,#photo6:hover > label span,#photo7:hover > label span,#photo8:hover > label span {
	pointer-events:auto;
	opacity:1;
}
/* 送りボタンクリック時のanimation設定 */
#b2:checked ~ #photos { left:1%; }
#b3:checked ~ #photos { left:-19%; }
#b4:checked ~ #photos { left:-39%; }
#f5:checked ~ #photos { left:-19%; }
#f6:checked ~ #photos { left:-39%; }
#f7:checked ~ #photos { left:-59%; }
#b2:checked ~ #btns #p_btn { left:0%;  }
#b3:checked ~ #btns #p_btn { left:12%; }
#b4:checked ~ #btns #p_btn { left:24%; }
#f5:checked ~ #btns #p_btn { left:12%; }
#f6:checked ~ #btns #p_btn { left:24%; }
#f7:checked ~ #btns #p_btn { left:36%; }