js自适应

    function fixHeight() {
        var headerHeight = $("#switcher").height();
        $("#iframe").attr("height", $(window).height() + "px");
    }
    $(window).resize(function() {
        fixHeight();
    }).resize();

//iframe页面自适应
function setIframeHeight(iframe) {
    if (iframe) {
        var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
        if (iframeWin.document.body) {
            iframe.height = iframeWin.document.documentElement.scrollHeight || iframeWin.document.body.scrollHeight - 20;
        }
    }
}

猜你喜欢

转载自blog.csdn.net/wupd2014/article/details/71003174
今日推荐