增加iframe自适应高度

This commit is contained in:
Argo-Lenovo 2016-11-02 12:12:53 +08:00
parent 2792356db8
commit ea5229cfbe
1 changed files with 11 additions and 3 deletions

View File

@ -1,4 +1,12 @@
$(function () {
var fra = $('iframe').get(0);
fra.height = fra.contentDocument.body.offsetHeight;
$(function () {
function iframeResposive() {
try {
var fra = $('iframe').get(0);
fra.height = fra.contentDocument.body.offsetHeight;
}
catch (e) {
}
}
$(window).on('load', iframeResposive);
$(window).on('resize', iframeResposive);
});