layui tab 컨트롤 에서 외부 html 페이지 불 러 오기
@{
Layout = null;
}
Tab
-
-
layui.use('element', function () {
var $ = layui.jquery
, element = layui.element; //Tab , , element
});
// ,iframe
function calcPageHeight(doc) {
var cHeight = Math.max(doc.body.clientHeight, doc.documentElement.clientHeight);
var sHeight = Math.max(doc.body.scrollHeight, doc.documentElement.scrollHeight);
var height = Math.max(cHeight, sHeight);
return height;
}
function iframeInit(id) {
// ID iframe
var ifr = document.getElementById(id);
ifr.onload = function () {
//
ifr.style.height = '0px';
var iDoc = ifr.contentDocument || ifr.document;
var height = calcPageHeight(iDoc);
if (height < 850) {
height = 850;
}
ifr.style.height = height + 'px';
};
}
$(function () {
iframeInit('main2');
iframeInit('main1');
});