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://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
<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&campaignid=176&zoneid=3&loc=http%3A%2F%2Fwww.mmdwc.com%2Fmagazine%2F&cb=9b2dbdb22f" alt="" style="width: 0px; height: 0px;" height="0" width="0">
</div>
</body>
</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});
}
You have acces to your iFrame with next sentence:
<script type="text/javascript">
$(document).ready(function () {
$("#a0811af3").on('load', function () {
$("#a0811af3").contents().find("your image").on("click", function (e) {
});
});
});
This case works when you do it click inside an image. It's rigth?, It's what you need?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.