Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is it possible to create a custom cursor from glyphicon?

I was wondering if custom cursor can be made from glyphicon. one way i can think of is to make cursor property none over body. Set the glyphicon z-index to top most with absolute positioning based on jquery mousemove x,y coordinates. is this the right way or is there any native methods ?

like image 368
Sagar Avatar asked Dec 09 '25 09:12

Sagar


1 Answers

Although i did not find the native way to do this. But here's how i did it with jquery and css property.

#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>
like image 141
Sagar Avatar answered Dec 11 '25 23:12

Sagar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!