在iframe中加载我的网站 - 隐藏套栏div
题
我正在在另一个站点集中加载iframe中的mysites。这与PageViewer WebPart一起使用,但我想隐藏新套管,因为父页面上已经有一个。关于如何做到这一点的任何想法?以下jquery应该工作,但似乎无法找到“套栏”的孩子。我的猜测是这种火灾时未加载的iframe,但我可以得到该元素。我是我在未定义的情况下显示的孩子。
$(document).ready(function() {
var iframe = document.getElementById("MSOPageViewerWebPart_WebPartWPQ2");
var sb = $('#MSOPageViewerWebPart_WebPartWPQ2').contents().find('#suiteBar');
});
. 解决方案
因为您可以使用PageViewer Web部分查看MySite,我假设它在同一域内。
<script type="text/javascript">
$(document).ready(function(){
var mySiteIframe = $("#MSOPageViewerWebPart_WebPartWPQ2");
mySiteIframe.load(function(){
window.console && console.log('Loading Iframe');
mySiteIframe.contents().find("#suiteBar").css("display", "none");
});
});
</script>
.