2015-09-07 112 views
3

我想知道如果自定義光標可以由glyphicon。我可以想到的一種方式是使光標屬性不超過身體。通過基於jquery mousemove x,y座標的絕對定位將glyphicon z-index設置爲最高。這是正確的方式,還是有任何本地方法?是否可以從glyphicon創建自定義光標?

+0

什麼你嘗試到現在? –

+1

http://stackoverflow.com/questions/1144836/css-cursor-customization – guest271314

+0

製作圖標的截圖圖像會更簡單,並使用位圖鼠標光標。你可能能夠做到這一切幻想,並使用html2canvas在飛行中產生圖像。 – dandavis

回答

3

雖然我沒有找到原生的方式來做到這一點。 但here's我是如何做到這一點與jQuery和CSS屬性。

#test{ 
    width:200px; 
    height:200px; 
    cursor:none; 
    background-color:#ff0000; 
} 

#mycur{ 
    position:absolute; 
    z-index:1000; 
    cursor:none; 
} 

$("#test").mousemove(function(e){ 
    mycur=$("#mycur"); 
    mycur.css("left",e.offsetX); 
    mycur.css("top",e.offsetY); 
}); 

<div id="test"> 
</div> 
<i id="mycur" class="fa fa-paint-brush"></i> 
相關問題