代码之家  ›  专栏  ›  技术社区  ›  farmpapa

隐藏iframe中显示的Sharepoint自定义列表的标题

  •  0
  • farmpapa  · 技术社区  · 6 年前

    1) 我甚至无法通过在url末尾添加?isdlg=1(即..allitems.aspx?isdlg=1)使其在正常页面上工作

    2)

    <div class="ms-dlgFrameContainer">
    <iframe width="1400" height="600" id="DlgFramee" class="ms-dlgFrame" frameborder="0" src="myurl.aspx">
    <html class="ms-dialog">
    <head>
    <style type="text/css">
    .ms-dialog #titleAreaBox { display:none }
    </style>`
    

    3) 在iframe中隐藏页面标题。

    <script type="text/javascript">
    document.getElementById("myiframe1").contentWindow.document.getElementById("titlerow").style.display = "none"; </script>`
    

    4) 最有希望的。当我加上

    <iframe id="myiframe1" src="myurl" width="1000" height="450" frameborder="1"></iframe>
    <style>
    #titleAreaBox { display: none }
    </style>
    

    在与iframe相同的CEWP中,它删除当前页面的标题区域,而不是iframe中的页面。这正是我想要的,除了我希望它对iframe内的页面执行此操作。

    5) 我也这样做了,甚至只是试图改变标题颜色,但没有注意到任何变化。我查找了正确的Web部件ID。

    <style type="text/css">
    #MSOZoneCell_WebPartWPQ2 .ms-WPHeader
    { background-color: pink; }
    </style>
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   Lee    6 年前

    你可以试试下面的jQuery脚本,我只是隐藏 suiteBarTop 在演示中。

    <iframe id="myiframe" width="1400" height="600" id="DlgFramee" class="ms-dlgFrame" frameborder="0" src="/sites/tst/SitePages/Home.aspx"></iframe>
    
    <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
        <script type="text/javascript">
            $(function () {
                $('#myiframe').load(function () {
                    $(this).contents().find('#suiteBarTop').hide();
                });
    
            })        
        </script>