I am trying to make the background color of a row change on hover with only the area of the cursor changing color/being highlighted.
I have a white background color set, and would like to have the area of the cursor highlighted with a yellow feathered circle when hovering over the background.
I can't seem to find the proper code for it, but only finding codes to change the complete background on hover.
Is this something that's possible to do in CSS?
.vc_row {
-webkit-transition:all 1s;
transition:all 1s;
}
.vc_row:hover {
background: -webkit-gradient(
radial, 500 25%, 20, 500 25%, 40, from(#faf9f4), to(#cef230)
);
}
Even through my predisposition to using JavaScript (it is where my skills lie), I believe you can't just do this in CSS, but also need JavaScript to do this. There might be a way, but I don't know it, and I am curious for someone else to answer with a magical full CSS solution and blow our minds. :D
For one approach of doing this, you need to use
::afterto create the hover-element inside the row. You can then use CSS variables to pass your mouse position (gathered through JavaScript) into the hover-element, making it track the mouse position. Here is an example:Key elements are the
::afterto create the hover-element, the use ofposition: absolute;to allow for "top" and "left" attributes to position the hover-element, and applyingoverflow: hidden;to the row: in my testing the hover-element kept the mouse-move event firing even outside the row, unless overflow was hidden.