I'm trying to include images in a Masonry item. Adding images to a Masonry item works fine when the images are added to a node as image content. But when you try to add images via CSS Image Replacement techniques (assigning a background-image to a class), the images are not displaying on the Masonry item.
I've successfully displayed an image this way on the full node. When I look at the HTML being generated, I see this:
<img class="cs-tag-credit">
And the image displayed via CSS Image Replacement displays correctly, using the following CSS:
.cs-tag-credit
{
width: 180px;
height: 25px;
background-image: url(../images/SubIcon-Credit.png);
background-repeat: no-repeat;
}
However, when I look at the HTML being generated for the Masonry item, I see this:
<img class="cs-tag-credit" src="">
So it looks like the Masonry module is adding an empty src="" attribute to the img tag, which is killing any image replacement attempt.
I tried looking at this in a non-Masonry view and the image is displaying fine. Views produces the same
that is in the HTML I added to the node.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | Masonry Background Image | 536.24 KB | kyletaylored |
Comments
Comment #1
kyletaylored commentedI retract my comment. I understand what you mean. I don't know why you'd want to do that, but I would say that is an issue with the Masonry js, not the module.
Comment #2
Anonymous (not verified) commentedI agree.
Comment #3
billp44ruby commentedIf you "don't understand why you would want to do that", I'd be interested to hear if you have an alternative approach you'd recommend.
For the site I'm designing, I have different 'types' of content (i.e, articles, polls, quizzes), so each Masonry image tile needs to display the content type, in the form of an icon. To make things more challenging, this 'site' will be integrated into other customer's website and will be 're-branded' or 're-themed' to match the client's styleguide standards. That may include changing out icons, etc.
It seemed to me that CSS image replacement was the easiest way to achieve this. I'd tag each node once and then just change the icons via CSS. If there are better ways to do this, believe me, I'm all ears.
Thanks.
Comment #3.0
billp44ruby commentedAdded
tags around HTML and CSS