Possibility to wrap the image in a <a> element
See original GitHub issueThank you for this awesome plugin.
I have a question: if we wrap this component in a <a>
HTML element, we cannot hook into the Media
onClick
event, therefore the preventing default of the event is not happening.
Example:
<a href='/b'>
<div which loads the image />
</a>
So the https://github.com/stereobooster/react-ideal-image/blob/master/src/components/Media/index.js#L155 could do an event prevent default.
Thank you!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
html - Is it possible to wrap a <picture> element inside a <a>?
I have tried wrapping this to a but this doesn't work (do not show any images). <a class="site-header ...
Read more >How to wrap the text around an image using HTML and CSS
In HTML, we can either align the image on the right side of the text, or to the left, or to the center....
Read more >Wrap text around any image or shape that you want! - YouTube
The first 1000 people to use the link will get a free trial of Skillshare Premium Membership: https://skl.sh/kevinpowell03211Shape-outside ...
Read more >How to Wrap Text Around an Image With CSS - ThoughtCo
Using CSS, you can place your images on a page and then wrap the text around them. This tutorial explains how easy it...
Read more >HTML- Text- Wrapping Text Around Images
You can position images on the page using the ALIGN attribute, and in this case, you can use the Top, Middle, or Bottom...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah now I see the problem
I have exact this case using an
img
insidea
. I put it like this so that I can click on it and navigate, except when the image is not loaded because the user is running on2g
or so; therefore, when I click on the download image icon, the event is propagated, and instead of just downloading the image, I navigate to thehref
.In this case I’d need to rewrite the entire logic in the
a onClick
handler (which is now in theMedia
component).