Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple images inside imageliquid container causes a problem #24

Open
Frique opened this issue Apr 2, 2014 · 7 comments
Open

Multiple images inside imageliquid container causes a problem #24

Frique opened this issue Apr 2, 2014 · 7 comments

Comments

@Frique
Copy link

Frique commented Apr 2, 2014

I'm applying the plugin on a div which has other elements inside it (as a large photo background). When the child elements have images, they are hidden by the plugin. Please target all imageLiquid elements by class/id so it doesn't affect other elements within the selector's ranges.

(similar to the other issue regarding a:first)

@karacas
Copy link
Owner

karacas commented Apr 2, 2014

Multiple imgLiquid images:

<div class="imgLiquidFill imgLiquid" style="width:300px; height:200px;">
    <img alt="Woody" src="Woody1.jpg" />
</div>
<div class="imgLiquidFill imgLiquid" style="width:300px; height:200px;">
    <img alt="Woody" src="Woody2.jpg" />
</div>
<div class="imgLiquidFill imgLiquid" style="width:300px; height:200px;">
    <img alt="Woody" src="Woody3.jpg" />
</div>

@Frique
Copy link
Author

Frique commented Apr 2, 2014

Hi.
I mean this case:

<div class="imgLiquidFill imgLiquid" style="width:300px; height:200px;">
    <img alt="Woody" src="Woody1.jpg" />

    <div>
        Other stuff here, on top of image background
        <img src="unrelated-image.jpg">
    </div>
</div>

@karacas
Copy link
Owner

karacas commented Apr 2, 2014

Try this.
(think imgLiquid container as your img)

<div class="imgLiquidFill imgLiquid" style="width:300px; height:200px;">
    <img alt="Woody" src="Woody1.jpg" />
</div>
<div>
    Other stuff here, on top of image background
    <img src="unrelated-image.jpg">
</div>

@Frique
Copy link
Author

Frique commented Apr 2, 2014

That won't work because imgLiquid is supposed to be behind the other content, serving as a background. In fact in my real life usage i don't set a width and height, because the inside content stretches the parent imgLiquid to the right size.

@Frique
Copy link
Author

Frique commented Apr 2, 2014

I suggest an alternative way to provide the source image is via a data-attribute on the div. So no image element is needed and no other child-elements need be affected.

<div class="imgLiquidFill imgLiquid" data-image="Woody1.jpg"></div>

@TylerFisher
Copy link

Replicated this. @Frique's solution seems okay, but I specifically want to use imgLiquid because it uses an <img> tag, which helps with Google News parsers and other robot scrapers that don't run JavaScript. I suggest requiring a class (perhaps class="liquid") on the image being resized, that way the library can apply display: none and visibility: hidden to only the necessary elements.

@omfgitsasalmon
Copy link

Found the solution.

Replace
imgLiquid.injectCss=".imgLiquid img{visibility:hidden}" and i("img",u).css({display:"none"})
with
imgLiquid.injectCss=".imgLiquid img:first {visibility:hidden}" and i("img:first",u).css({display:"none"})

And only the first image will be taken for the container, the rest will remain as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants