Thomas Thomas - 4 months ago 6
CSS Question

how to place image on image?

suppose i have one div and div has img tag like

<div><img src='img1.png'/></div>
so when page will run then img1.png will load inside in div. i just need to know how could i place a another small image at the center on the like any busy image on img1.png. what would be the best way to do it like using jquery or css. give me css or jquery for placing small image on div at center.

i have another question that if a div has background image set with css then can i determine that background images download complete or not using jquery ? if possible then please show me a sample code. thanks


Use wrap to add another div on top of the image...

$("#divID img").each(function() {
    var $overlay = $('<div></div>');
        position: "relative",
        display: "inline-block",
        width: $(this).width(),
        height: $(this).height(),
        backgroundPosition: "center center",
        backgroundImage: "url(loading-image.gif)"