I have a map which consists of 100 field divs and I want to change fields' box-shadow on hover, so I have the CSS code like:
.field:hover {
box-shadow: inset 0px 0px 100px 0px rgba(255,0,0,0.3);
}
I noticed that when the field div is empty (< div class="field" >< /div >
) the div's box-shadow
changes instantly on hover and everything runs smoothly. However, if I put ANY content in that div (e.g. < div class"field" >some content< /div >
) there is a visible delay between the moment I put the cursor on it and the moment it gets the box-shadow.
Another interesting thing I noticed is that even if I set the background-image on that div (< div class="field" style="background-image: url(image.jpg)" >< /div >
) if it's empty it still runs faster than the div with no background image, but some content inside.
Basicly my question is - is there any way I can achieve the hover-state-change speed of the empty div (or at least close to that) on the div that has some content inside?
@edit:
So I couldn't really reproduce this "no-content vs content" difference on fiddle, but I figured out that the problem appears only when the field has some box shadow by default. And that I can show you: https://jsfiddle.net/azp0w668/2/
In my project the problem appears only when there is content inside the div (otherwise it runs smoothly), but here it seems to appear even when the div is empty, but only if it has box-shadow (I created a toggle button so you can see the difference)