Is it possible to share across the cursor position in an element say with the class="board"
so that others can see it as a translucent circle or something?
- Is it possible to get the cursor position with jquery?
- Is it possible to pass them over to another use开发者_运维百科r and replicate it there with an image?
- If its possible, what will be the best method to do so?
You can get the mouse position using mousemove events:
$(document).mousemove(function(e){
console.log(e.pageX +', '+ e.pageY);
});
If you want to transfer the information to another user, just send the coordinates via an XMLHttpRequest to your server and then bounce that data back to that user. This will give you a bit of lag, but that's to be expected.
If I correctly understand what you mean by "replicate it there with an image", just used a fixed-positioned cursor image (set with Javascript using the coordinates you receive) to simulate both cursors being there at once.
精彩评论