vendredi 29 mai 2015

change img size inside iframe with jquery

I'm using an adserver on my website. All adds are using iframe, and I'm trying to target the img (the first one with width = 728 & height = 90) inside the iframe to change its size (width & height). I've been able to target the body (changing its background color to test), but I can't target the image to change its size. here is the iframe code, I need to target the iframe object, and not the iframe class, because the class changes every time.

<div class="insert_pub">
<iframe id="a0811af3" width="" height="90" frameborder="0" scrolling="no" src="/www/delivery/afr.php?zoneid=3&cb=INSERT_RANDOM_NUMBER_HERE" name="a0811af3">
#document
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html lang="en" xml:lang="en" xmlns="http://ift.tt/lH0Osb">
<head></head>
<body>
<a href="/www/delivery/ck.php?oaparams=2__bannerid=212__zoneid=3__cb=9b2dbdb22f__oadest=http%3A%2F%2Fthebayfestival.fr%2F" target="_blank">
    <img src="/www/images/c34d3222b19118f97aa99e76310c70fe.jpg" alt="" title="" height="90" border="0" width="728">
</a>
<div id="beacon_9b2dbdb22f" style="position: absolute; left: 0px; top: 0px; visibility: hidden;">
    <img src="/www/delivery/lg.php?bannerid=212&amp;campaignid=176&amp;zoneid=3&amp;loc=http%3A%2F%2Fwww.mmdwc.com%2Fmagazine%2F&amp;cb=9b2dbdb22f" alt="" style="width: 0px; height: 0px;" height="0" width="0">
</div>
</body>
</html>
</html>
</iframe>
</div>

here is what I've tried, but it's not working :

function iframe_insert_size() {
  $(".insert_pub iframe").contents().find("img").css({"width":624, "height" : 77});
}

can anybody help me with this ?

thanks a lot,

Aucun commentaire:

Enregistrer un commentaire