Search code examples
javascriptjquerycursor

change cursor by an image not working in browsers


I want to change my cursor into the same image when i click on it.

$(document).ready(function () {    
    $("#ggimg").click(function() {
        $("#ggimg").hide();
        $('#cursor').css('cursor','28283198.jpg"),-moz-zoom-in');
        //$('#cursor').css('cursor','28283198.jpg"),default');
    });
});
#cursor {
     width: 200px; 
     height: 200px; 
     border: 1px solid black;
}
<div id="cursor" style="border:solid 1px;"></div>
<img src="../img/basket_anm.png" id='ggimg'>

please share some idea. thanks


Solution

  • You should provide cursor url as following way.

    $(document).ready(function () {    
        $("#ggimg").click(function() {
            $("#ggimg").hide();
            $('#cursor').css('cursor','url(28283198.jpg),auto');
        });
    });