I have tried to change the images on my site from img
to svg
, changing img
tags to embed
and object
tags. But, implementing the onclick
function, which previously was contained in the img
tag, is proving most difficult.
I found onclick
had no effect when placed inside the object
or embed
tag.
So, I made a div
exclusively for the svg, and placed onclick
in this div
tag. But, no effect unless visitor clicks on the edges/padding of the image.
I have read about overlaying a div
, but am trying to avoid using absolute
positioning, or specifying position
at all.
Is there another way to apply onclick to a svg?
Has anyone encountered this problem? Questions and suggestions are welcome.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…