2015-04-23 158 views
0

我在我的網站上創建了一個「右側滑動菜單」。它的工作原理和一切都很好,但是當我將鼠標指向菜單圖標時,它向我顯示一個正常光標(look at the picture in link)。我需要一個指針光標而不添加任何鏈接。更改鼠標光標在按鈕上 - 正常指針

#buttonu5815{ 

     transition-property: top; 
     transition-duration: 0.2s; 
     transition-timing-function: ease; 

     -webkit-transition-property: top; 
     -webkit-transition-duration: 0.2s; 
     -webkit-transition-timing-function: ease; 
    } 

var theMenu; 
var originLeft; 

window.onload = function() { 
    //Click to open on the Muse Icon 
    element = document.getElementById("buttonu5717"); 
    element.onclick = openMenu; 

    //save the Left position 
    originLeft = document.getElementById("buttonu5815").style.top; 
    //Get the Menu element 
    theMenu = document.getElementById("buttonu5815"); 

    //Click to close 
    closeBtn = document.getElementById("buttonu5822"); 
    closeBtn.onclick = closeMenu; 
} 

function openMenu(){ 
    theMenu.style.top = 0; 
} 

function closeMenu(){ 
    theMenu.style.top = originLeft; 
} 
+0

你就不能添加'光標:指針'到你的按鈕課? –

+0

好的,作品,謝謝! –

回答

3

我覺得這個CSS是你在找什麼。

#buttonu5815:hover { 
    cursor:pointer; 
} 
0

可以實現對懸停事件這樣使用CSS,只需設置相關的類/ html標記(例如,用於鋰元素):

li:hover { 
    cursor: pointer; 
}