这是我的HTML:
<div class="slides">
<input type="radio" name="radio-btn" id="img-1" checked="checked"/>
<div class="slide-container">
<div class="slide">
<img src="${context:layout/images/top1.jpg}" />
</div>
<div class="nav">
<label for="img-6" class="prev">‹</label>
<label for="img-2" class="next">›</label>
</div>
</div>
<input type="radio" name="radio-btn" id="img-2" />
<div class="slide-container">
<div class="slide">
<img src="${context:layout/images/top2.jpg}" />
</div>
<div class="nav">
<label for="img-1" class="prev">‹</label>
<label for="img-3" class="next">›</label>
</div>
</div>
<input type="radio" name="radio-btn" id="img-3" />
<div class="slide-container">
<div class="slide">
<img src="${context:layout/images/top3.jpg}" />
</div>
<div class="nav">
<label for="img-2" class="prev">‹</label>
<label for="img-4" class="next">›</label>
</div>
</div>
<input type="radio" name="radio-btn" id="img-4" />
<div class="slide-container">
<div class="slide">
<img src="${context:layout/images/top4.jpg}" />
</div>
<div class="nav">
<label for="img-3" class="prev">‹</label>
<label for="img-5" class="next">›</label>
</div>
</div>
<input type="radio" name="radio-btn" id="img-5" />
<div class="slide-container">
<div class="slide">
<img src="${context:layout/images/top5.jpg}" />
</div>
<div class="nav">
<label for="img-4" class="prev">‹</label>
<label for="img-6" class="next">›</label>
</div>
</div>
<input type="radio" name="radio-btn" id="img-6" />
<div class="slide-container">
<div class="slide">
<img src="${context:layout/images/top6.jpg}" />
</div>
<div class="nav">
<label for="img-5" class="prev">‹</label>
<label for="img-1" class="next">›</label>
</div>
</div>
</div>
上面的代码是我的HTML代码。它有带导航的图像幻灯片,但我想用手指触摸包括图像滑动。
这是我的css:
.slides
{
padding: 0px;
width: 100%;
height: 100px;
display: block;
position: relative;
margin: 0px;
float: left;
}
.slide-container
{
display: block;
}
.slides *
{
user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-khtml-user-select: none;
-webkit-user-select: none;
-webkit-touch-callout: none;
}
.slides input { display: none; }
.slide
{
top: 0;
opacity: 0;
width: 100%;
height: 100px;
display: block;
position: absolute;
transform: scale(0);
transition: all .7s ease-in-out;
}
.slide img
{
width: 100%;
height: 100%;
}
.nav label
{
width: 40px;
height: 50%;
display: none;
position: absolute;
margin-top:25px;
opacity: 0;
z-index: 9;
cursor: pointer;
transition: opacity .2s;
color: #FFF;
font-size: 50pt;
text-align: center;
line-height: 50px;
font-family: "Varela Round", sans-serif;
background-color: rgba(255, 255, 255, .3);
text-shadow: 0px 0px 15px rgb(119, 119, 119);
}
.slide:hover + .nav label { opacity: 0.5; }
.nav label:hover { opacity: 1; }
.nav .next { right: 0; }
input:checked + .slide-container .slide
{
opacity: 1;
transform: scale(1);
transition: opacity 1s ease-in-out;
}
input:checked + .slide-container .nav label { display: block; }
.nav-dots
{
width: 100%;
bottom: 9px;
height: 11px;
display: block;
position: absolute;
text-align: center;
}
.nav-dots .nav-dot
{
top: -5px;
width: 11px;
height: 11px;
margin: 0 4px;
position: relative;
border-radius: 100%;
display: inline-block;
background-color: rgba(0, 0, 0, 0.6);
}
.nav-dots .nav-dot:hover
{
cursor: pointer;
background-color: rgba(0, 0, 0, 0.8);
}
.nav-dots .nav-dot:hover
{
cursor: pointer;
background-color: rgba(0, 0, 0, 0.8);
}
上面的代码是带有点击功能的图像滑块。我希望用上面的代码包括手指触摸滑动。