karacas / imgLiquid

jQuery plugin to resize images to fit in a container.
http://goo.gl/Wk8bU
MIT License
970 stars 207 forks source link

Move/copy title attribute from IMG to surrounding DIV #11

Closed blueyed closed 11 years ago

blueyed commented 11 years ago

If there is a title attribute used/provided with the IMG tag, its "popup" functionality gets lost, because the image itself gets hidden.

The attribute could get copied over to the surrounding DIV.

karacas commented 11 years ago

Daniel , that passage of data is best done for each particular case, to avoid malfunctions. in your case, I recommend you try put the popUp to an href:

<div class="imgLiquidFill imgLiquid" style="width:300px; height:200px;">
    <a href="#" class="PopUp" title="">
        <img alt="Woody" src="Woody.jpg" />
    </a>
</div>

Hope this helps, good luck with that!

karacas commented 11 years ago

You can also manually clone attributes, like this:

//Normal call
$(".imgLiquidFill").imgLiquid();

//Clone attribute: tittle from .imgLiquid img' to '.imgLiquid'
$('.imgLiquid img').each(function(){
    $(this).closest('.imgLiquid').attr('tittle', $(this).attr('tittle') );
})
blueyed commented 11 years ago

Thanks. Manually transferring the title attribute is good enough.

This might also be accomplished using imgLiquid's callback function(s).