dimanche 29 avril 2018

Setting an onclick event to an empty span (an icon set in CSS)?

I have inherited a codebase where icons are set across an image using some <span>s spread across an image. The spans look something like:

<span class='circle_logo'></span>

I need to trigger something to happen in the onclick event of these icons.

I have overcome this problem in the past by switching to <button>, but that does not work in this instance (it messes up the specific placement). I tried adding some &nbsp;s to the spans but it did not work, it seems like even if I add characters the clicks have to be on the actual pixels of the characters. Any thoughts?

Thanks for reading.




Aucun commentaire:

Enregistrer un commentaire