我正在为Wordpress主页实现全屏引导转盘,其中幻灯片的背景图像设置为背景大小:封面。图像也需要从一个淡入淡出到下一个,每张幻灯片都包含一个单独的标题,该标题是指向该网站另一部分的单独链接。
但是,因为我必须将.item类设置为'position:fixed',所以标题链接无法正常工作 - 尽管每个标题的文本显示正常,但只有最终的幻灯片标题链接正常工作,其他人在其下面“隐藏”,因此每个标题链接到同一个URL,即最后一个URL。
有什么方法可以解决这个问题吗?
感谢。
这是HTML:
<div id="myCarousel" class="carousel container slide carousel-fade">
<div class="carousel-inner">
<div class="active item one">
<div class="carousel-caption">
<h2><a href="http://www.topographicwebdesign.co.uk/work-form/category/work/#astral">Astral Pattern</a></h2>
</div>
</div>
<div class="item two">
<div class="carousel-caption">
<h2><a href="http://www.topographicwebdesign.co.uk/work-form/category/work/#shark">Imaginary Music - La Shark</a></h2>
</div>
</div>
<div class="item three">
<div class="carousel-caption">
<h2><a href="http://www.topographicwebdesign.co.uk/work-form/category/work/#troubled">Troubled Waters</a></h2>
</div>
</div>
</div>
<a class="carousel-control left" href="#myCarousel" data-slide="prev"></a><a class="carousel-control right" href="#myCarousel" data-slide="next"> </a>
</div>
这是CSS:
.carousel .item {
position: fixed;
width: 100%;
height: 100%;
display:block;
left:0px;
}
.carousel .one {
background: url('http://www.topographicwebdesign.co.uk/work-form/wp-content/uploads/2016/01/Bunhill-Walking-Map_small.jpg') no-repeat center center;
background-size: cover;
-moz-background-size: cover;
}
.carousel .two {
background: url('http://www.topographicwebdesign.co.uk/work-form/wp-content/uploads/2016/01/Imaginary-Music_small.jpg') no-repeat center center;
background-size: cover;
-moz-background-size: cover;
}
.carousel .three {
background: url('http://www.topographicwebdesign.co.uk/work-form/wp-content/uploads/2016/01/Sir-Johns-Nose_small.jpg') no-repeat center center;
background-size: cover;
-moz-background-size: cover;
}
.carousel .active.left {
left:0;
opacity:0;
z-index:2;
}
.carousel-control.left,.carousel-control.right{
width:10px;
height:10px;
border-radius:25px;
-moz-border-radius:25px;
-webkit-border-radius:25px;
background-color:white;
position:fixed;
background-image:none;
}
.carousel-caption{
position:absolute;
bottom:10px;
left:0;
right:0;
text-shadow:none;
}
.carousel-control {
cursor:pointer;
}
.carousel-control.left {
left:10px;
right:auto;
top:50%;
}
.carousel-control.right {
right:10px;
top:50%;
}
a.carousel-control:hover{
background-color:white;
}
.carousel-fade .carousel-inner .item {
opacity: 0;
transition-property: opacity;
transition-duration: .8s;
-webkit-transition-property: opacity;
-webkit-transition-duration: .8s;
-moz-transition-property: opacity;
-moz-transition-duration: .8s;
}
.carousel-fade .carousel-inner .active {
opacity: 1;
}
.carousel-fade .carousel-inner .active.left,
.carousel-fade .carousel-inner .active.right {
left: 0;
opacity: 0;
z-index: 1;
}
.carousel-fade .carousel-inner .next.left,
.carousel-fade .carousel-inner .prev.right {
opacity: 1;
}
.carousel-fade .carousel-control {
z-index: 2;
}
这是Javascript:
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('.carousel').carousel({interval: 5000});
});
</script>