q444916237 2015-06-16 01:35 采纳率: 100%
浏览 6938
已采纳

关于easyui tab iframe 高度问题

$(function() {
    for ( var i = 0; i < 1; i++) {
        addTab(i, 'http://www.163.com');
    }
});
function addTab(subtitle, url) {
    if (!$('#tabs').tabs('exists', subtitle)) {
        $('#tabs').tabs('add', { 
            title: subtitle,
            content: createFrame(url),
            closable: true 
        });
        $('#tabs').tabs('getSelected').css('width', 'auto'); 
        //重新tab body宽度为auto,如果你上面的添加语句设置了selected为false,注意使用下面注释的这句来获取你的tab
        //$('#tabs').tabs('getTab', subtitle).css('width', 'auto');
    }
    tabClose();
    $('#tabs').tabs('getSelected').css('width', 'auto'); 
}

function createFrame(url) {
    var s = '<iframe scrolling="auto" frameborder="0"  src="' + url
            + '" style="width:100%;height:100%;"></iframe>';
    return s;
}

function tabClose() {
    /*双击关闭TAB选项卡*/
    $(".tabs-inner").dblclick(function() {
        var subtitle = $(this).children("span").text();
        $('#tabs').tabs('close', subtitle);
    });
}



    <div title="欢迎使用" style="padding: 20px; overflow: hidden;height: auto;width: 100px;" id="home">

        <h1>
            <a href="javascript:addTab('test','addTDemo.jsp');">111</a>
        </h1>

    </div>

</div>

 运行后的代码


style="width: auto; height: auto;">

        <div class="panel" style="display: block; width: auto;">
            <div title=""
                style="padding: 20px; overflow: hidden; height: auto; width: 1558px;"
                id="home"
                class="panel-body panel-body-noheader panel-body-noborder">

                <h1>
                    <a href="javascript:addTab('test','addTDemo.jsp');">111</a>
                </h1>

            </div>
        </div>

        <div class="panel" style="display: none; width: auto;">
            <div title=""
                class="panel-body panel-body-noheader panel-body-noborder"
                style="width: 1598px; height: auto;">
                <iframe scrolling="auto" frameborder="0" src="http://www.163.com"
                    style="width:100%;height:100%;"></iframe>
            </div>
        </div>
    </div>
</div>


""
图片说明
高度很低。

  • 写回答

2条回答 默认 最新

  • q444916237 2015-06-16 03:17
    关注

    已经解决。去掉tabs的class,在JS里写
    $("#tabs").tabs({
    width:$("#tabs").parent().width(),
    height:$("#tabs").parent().height()
    });

    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥200 相机拍直接转存到电脑上 立拍立穿无线局域网传
  • ¥15 (关键词-电路设计)
  • ¥15 如何解决MIPS计算是否溢出
  • ¥15 vue中我代理了iframe,iframe却走的是路由,没有显示该显示的网站,这个该如何处理
  • ¥15 操作系统相关算法中while();的含义
  • ¥15 CNVcaller安装后无法找到文件
  • ¥15 visual studio2022中文乱码无法解决
  • ¥15 关于华为5g模块mh5000-31接线问题
  • ¥15 keil L6007U报错
  • ¥15 webapi 发布到iis后无法访问