It's a fairly simple jQuery function but I'm dealing with an iframe which will be displayed on clients' websites who may not be using jQuery. How would this look as pure JS?
$("#pgft-gvway-3xs-iframe").load(function() {
$(this).height($(this).contents().find("html").height() );
});
UPDATE:
Thanks to everyone who answered. Using a combination of answers I used the following. It did what I needed it to:
window.addEventListener('load', function(e) {
var elem= document.getElementById("pgft-gvway-3xs-iframe");
var insideheight= elem.contentWindow.document.height;
elem.style.height= insideheight + "px";
}, false);
var elem= document.getElementById("pgft-gvway-3xs-iframe");
var insideheight= elem.contentWindow.document.height;
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.