Currently, I am working on a project that involves multiple spans placed side by side, with each span containing a letter of the text. My aim is to create a functionality where hovering over one of these spans will not only hide that particular span but also others nearby.
This setup produces an image resembling the following:
@@@@@@@@@@@@@@
@@@@@@@@@@@@@@
@@@@@@@@@@@@@@
@@@@@@@@@@@@@@
The objective here is to conceal all spans within a specific distance from the mouse pointer, as illustrated in this example:
https://i.sstatic.net/fkXze.png
In terms of HTML structure:
<span id="overlay-1">@</span>
<!-- ... -->
<span id="overlay-142">@</span>
<span id="overlay-143">@</span>
I have managed to hide individual spans by targeting their IDs upon mouseover and modifying the style property to display=none
. However, my main challenge lies in hiding all spans located close to the mouse cursor. Do you have any suggestions or solutions for this issue?