2013-12-13 45 views
0

我有一個問題。在我的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; 

} 

回答

0

如果去掉這兩個:

#button:active #buttbody{ 
    height: 40px; 
    margin-top: 60px; 

} 

#button:active #butttop{ 
    margin-top: 40px; 

} 

這將是點擊。 Here's a jsfiddle for it

+0

是的!它正在工作。我將它們改爲:懸停,不是:活躍,它的功能就像一個魅力。謝謝你,先生! – Milo

+0

你能把這個標記爲答案嗎:) –

+1

你可以使用http://ricostacruz.com/jquery.transit/插件來做動畫並在按鈕動畫完成後加載pdf。它也使用CCS3動畫。 – Hardy