我有一个问题。在我的 website .我有一个按钮,当我单击它时,我想将我发送到另一个 link但只有当我将它推到下半部分时它才会起作用。
这是代码:
<div id="button" onclick="location.reload();location.href='http://andreicarpen.com/cv.pdf'">
<div id="butttop" onclick="location.reload();location.href='http://andreicarpen.com/cv.pdf'"></div>
<div id="buttbottom" onclick="location.reload();location.href='http://andreicarpen.com/cv.pdf'"></div>
<div id="buttbody" onclick="location.reload();location.href='http://andreicarpen.com/cv.pdf'"></div>
<div id="buttfloor" onclick="location.reload();location.href='http://andreicarpen.com/cv.pdf'"></div>
</div>
#button {
height: 130px;
width: 300px;
margin-top:37%;
position: absolute;
left:50%;
margin-left: -150px;
cursor:pointer;
}
#button div {
position: absolute;
}
#buttfloor {
height: 50px;
width: 300px;
background: #34495e;
border-radius: 50%;
margin-top: 80px;
z-index: 1;
}
#butttop {
background: #e74c3c;
height: 40px;
width: 250px;
border-radius: 50%;
z-index:3;
margin-left: 25px;
-webkit-transition: all .2s;
-moz-transition: all .2s ;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
}
#buttbottom {
background: #c0392b;
height: 40px;
width: 250px;
border-radius: 50%;
margin-top: 80px;
margin-left: 25px;
z-index:2;
}
#buttbody {
background: #c0392b;
height: 80px;
width: 250px;
border-radius: 0;
margin-top: 20px;
margin-left: 25px;
-webkit-transition: all .2s;
-moz-transition: all .2s ;
-ms-transition: all .2s;
-o-transition: all .2s;
transition: all .2s;
z-index:2;
}
#button:active #buttbody{
height: 40px;
margin-top: 60px;
}
#button:active #butttop{
margin-top: 40px;
}
最佳答案
如果你去掉这两个:
#button:active #buttbody{
height: 40px;
margin-top: 60px;
}
#button:active #butttop{
margin-top: 40px;
}
它将是可点击的。 Here's a jsfiddle for it
关于html - anchor 仅在按钮的下半部分起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20575329/