父頁(yè)面操作子頁(yè)面
$("#iframe").load(function(){
var iframH = $(this).contents().find("html").outerHeight(true);
$(this).css("height", iframH+"px");
console.log(iframH);
});
子頁(yè)面操作父頁(yè)面
獲取的簡(jiǎn)易寫(xiě)法
$("子集", "父級(jí)");
iframe里面內(nèi)容操作父級(jí)
$(".header_title", window.parent.document).text();
等價(jià)于
$(window.parent.document).find(".header_title").text();
動(dòng)態(tài)刷新Iframe
原生js寫(xiě)法:
document.getElementById('FrameID').contentWindow.location.reload(true);
jquery寫(xiě)法:
$('#iframe').attr('src',$('#iframe').attr('src'));