2016-04-15 61 views
0

因此,我正在製作一個網站(驚喜,驚喜),我在頁面頂部有一個按鈕,當我點擊它時,它什麼都不做。我想知道如何解決它。使用一個按鈕移動到頁面上的某個ID

按鈕

<button class="Learn-Link" href="#VideoSlide">Learn How 
<div class="Learn-Triangle"></div> 
</button> 

我想前往

<div class="Slide" id="VideoSlide"> 
<!--More code here, but not relevant--> 
</div> 

回答

0

button沒有一個href部件屬性,你需要添加你的按鈕內的a標籤

#VideoSlide{ 
 
    position: relative; 
 
    top:1000px; 
 
    height: 100px; 
 
    background: pink 
 
}
<button class="Learn-Link" ><a href="#VideoSlide">Learn How</a> 
 
<div class="Learn-Triangle"></div> 
 
</button> 
 
<div class="Slide" id="VideoSlide"> 
 
<!--More code here, but not relevant--> 
 
</div>

0

您可以通過使用javascript 如觸發按鈕: -

<button type="button" onclick="alert('Hello world!')">Click Me!</button> 
相關問題