javascript - 隐藏 iframe 中显示的 Sharepoint 自定义列表的标题
问题描述
我有一个来自不同共享点站点(仍然是同一个域)的自定义列表,我想在没有标题的情况下在我的工作站点上显示(至少,摆脱功能区也很好)。我尝试了以下 4 种方法,但均未成功:
1)我什至无法通过将 ?isdlg=1 添加到我的网址末尾(即 ..allitems.aspx?isdlg=1)使其在正常页面上工作
2)因为我主要使用 SQL 而不是 HTML,所以我确信我可能搞砸了一些标签。
<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)我也这样做了,即使只是试图改变标题颜色但没有注意到任何变化。我查找了正确的 webpart ID。
<style type="text/css">
#MSOZoneCell_WebPartWPQ2 .ms-WPHeader
{ background-color: pink; }
</style>
解决方案
你可以试试下面的 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>
推荐阅读
- azure-devops-rest-api - 使用 Azure Devops Git Api 在浏览器中查看 UML 文件
- loops - 循环遍历一系列列并使用子图以网格方式(列和行)绘制它们
- javascript - 如何通过单击外部输入和 div 本身来隐藏 div
- javascript - 更新 React 组件中的默认值
- bash - 当未提供 --stable 选项时, sort -n 是否可以预测地处理关系?如果有,怎么做?
- groovy - 有没有办法在 Liferay 中获取工作流提交的表单字段?
- python - 具有多个连接的 Sqlalchemy 查询,包括非直接多对多关系
- c# - Unity C# 错误'cs0116'“命名空间不能直接包含字段或方法等成员”
- javascript - 在 mouseenter 上隐藏 div - 但保留它
- entity-framework-core - ef core plus 是否支持带减号的批量更新?