Linkedin嵌入的帖子高度无需滚动动态



在我页面上的LinkedIn嵌入帖子中,每条帖子都有不同的高度,并且有滚动条。有没有什么方法可以根据帖子的高度使高度动态?

<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6917261457768280064" height="950" frameborder="0" allowfullscreen="" title="Embedded post"></iframe>

https://codepen.io/salman-aziz/pen/XWVYbga

谢谢。它也帮助了我

// Get url from Iframe SRC add it in Anchor HREF
function shareIframeUrl() {
var src = $(".linkedinWidget iframe").attr('src');
href = src.replace('embed/', '');
$('#iframeurl').attr('href', href);
}
shareIframeUrl();
*, *::before, *::after {
box-sizing: inherit;
}
.linkedinWidget {
position: relative;
overflow:hidden;
}
.iframeurl {
display: block;
width: 100%;
height: 1600px;
overflow: hidden;
cursor: pointer;
position: absolute;
z-index: 111;
}
.linkedinPosts {
position: relative;
border: 3px solid #fff;
width: 100%;
height: 1606px;
}
.linkedinPosts:before {
content: '';
background: transparent;
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
z-index: 1;
border-radius: 6px;
border: 3px solid #fff;
box-shadow: 0 0 0 1em #fff;
}
.linkedinPosts iframe {
position: absolute;
width: 100%;
min-height: 1600px;
top: 0;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="linkedinWidget">
<a id="iframeurl" target="_blank" class="iframeurl" href="#"></a>
<div class="linkedinPosts">
<iframe src="https://www.linkedin.com/embed/feed/update/urn:li:share:6917261457768280064" height="" frameborder="0" allowfullscreen="" title="Embedded post"></iframe></div></div>

最新更新