2015-04-23 160 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; 
}