I am trying to create a hover effect at the position of a cursor, similar to what is shown in this example:
For reference, I have also created a code snippet: https://jsfiddle.net/onnmwyhd/
Below is the code I am using:
HTML
<div id="container"></div>
CSS
#container{
background-color: #6fc39a;
height:200px;
}
jQuery
$("#container").mousemove(function(e){
var x = e.pageX - this.offsetLeft;
var y = e.pageY - this.offsetTop;
$(this).html("X: " + x + " Y: " + y);
});
The desired color for the cursor position is:
background-image: -webkit-linear-gradient(-35deg, #35a28e, #a8e4a5);