gpt4 book ai didi

jquery - 链接在我的 slider 中不起作用

转载 作者:行者123 更新时间:2023-11-28 05:54:08 25 4
gpt4 key购买 nike

当我添加到以下幻灯片的链接时,无论我放什么,我唯一能够链接到的是最后一张幻灯片。有什么方法可以使用此幻灯片代码并同时使链接正常工作吗?

html

<ul class="slides">
<input type="radio" name="radio-btn" id="img-1" checked />
<li class="slide-container">
<div class="slide">
<a href="http://www.google.com"><img src="/wp-content/uploads/slider1.png" style="background-color:red;"/></a>
</div>
<div class="nav">
<label for="img-4" class="prev">&#x2039;</label>
<label for="img-2" class="next">&#x203a;</label>
</div>
</li>

<input type="radio" name="radio-btn" id="img-2" />
<li class="slide-container">
<div class="slide">
<a href="http://www.yahoo.com"><img src="/wp-content/uploads/slider2.png" style="background-color:white;"/></a>
</div>
<div class="nav">
<label for="img-1" class="prev">&#x2039;</label>
<label for="img-3" class="next">&#x203a;</label>
</div>
</li>

<input type="radio" name="radio-btn" id="img-3" />
<li class="slide-container">
<div class="slide">
<a href="http://stackoverflow.com/"><img src="/wp-content/uploads/slider3.png" style="background-color:yellow;" /></a>
</div>
<div class="nav">
<label for="img-2" class="prev">&#x2039;</label>
<label for="img-4" class="next">&#x203a;</label>
</div>
</li>

<input type="radio" name="radio-btn" id="img-4" />
<li class="slide-container">
<div class="slide">
<a href="http://codepen.io/"><img src="/wp-content/uploads/slider4.png" style="background-color:blue;" /></a>
</div>
<div class="nav">
<label for="img-3" class="prev">&#x2039;</label>
<label for="img-1" class="next">&#x203a;</label>
</div>
</li>

<li class="nav-dots">
<label for="img-1" class="nav-dot"></label>
<label for="img-2" class="nav-dot"></label>
<label for="img-3" class="nav-dot"></label>
<label for="img-4" class="nav-dot"></label>
</li>

CSS

.slides {
padding: 0;
width: 980px;
height: 241px;
display: block;
margin: 0 auto;
position: relative;
}

.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-container { display: block; }

.slide {
top: 0;
opacity: 0;
width: 980px;
height: 241px;
display: block;
position: absolute;
transition: all .7s ease-in-out;
}

.slide img {
width: 100%;
height: 100%;
}

.nav label {
width: 40px;
height: 100%;
display: none;
position: absolute;
opacity: 0.5;
z-index: 9;
cursor: pointer;
transition: opacity .2s;
color: #FFF;
font-size: 50pt;
text-align: center;
line-height: 225px;
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;
transition: opacity 1s slide;
}

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: 0px;
width: 10px;
height: 10px;
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);
}

js

setInterval(function(){
$(".next:visible").click();}, 5000);

这是我的 codepen

谢谢。

最佳答案

存在关于 z-index 的 css 问题。我已将与 checked 单选按钮对应的事件幻灯片的 z-index 值设置为 10。

input:checked + .slide-container  .slide {
opacity: 1;
z-index: 10;
transition: opacity 1s slide;
}
input:checked + .slide-container .nav label {
display: block;
z-index: 10;
}

但是除了 codepen 本身,您将无法在同一个选项卡中访问 c​​odepen 中的那些站点。而只是在新标签页中打开并查看。

引用这个fiddle您将无法打开 4 个网站中的任何一个,除非您不在新标签页中打开它们。

关于jquery - 链接在我的 slider 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37152568/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com