Change cursor using js and absolute positioning — hood practice?

Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
Create a div and assign the styles that you want, then using js turn to him and indicate that he followed the mouse using absolute positioning
$(window).on('mousemove', function(e){ $('.cursor').css({ top: e.pageY + 'px', left: e.pageX + 'px', }) });

when you do this, hide the standard cursor using the css cursor:none;

from the performance point of view it is justified or not to do so and it is better to use the same property css cursor:url(cursor.png);

Total result
by | 16 views

1 Answer

0 like 0 dislike
I think it is better to change the cursor than to hide it and then emulate. For example, the image of the pencil on the canvas in the graphics editor: the cursor is emulated — that is, a picture, move the cursor position on mousemove — will lag behind, and it will annoit user. IMHO it is better to have a set of cursors for all types of brushes and tools, and include them on the canvas via setting "cursor: url("my-brush.png")"

PS. But I don't know your case, so all this is purely IMHO.

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
40,796 users