Optimize the height of embedded Linkedin posts for a seamless viewing experience without the need for scrolling

I have noticed that in LinkedIn embedded posts on my page, each post has a different height and there are scrolls. Is there a way I can make the height dynamic according to the post height?

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

Visit this link for more information.

Answer №1

I appreciate your support. It truly has made a difference for me.

Answer №2

// Extracting URL from Iframe SRC and inserting it into Anchor HREF
    function getIframeUrl() {
        var src = $(".linkedinWidget iframe").attr('src');
        href = src.replace('embed/', '');
        $('#iframeurl').attr('href', href);
    }
    getIframeUrl();
*, *::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>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the best way to demonstrate the impact of autocomplete using a local array in jqGrid?

For this particular scenario, I am referencing this example The AutoComplete and effect are functioning, but with the URL as: ' http://trirand.com/blog/phpjqgrid/examples/jsonp/autocompletep.php?callback=?&acelem=ShipName ' In the code belo ...

Challenges with Internal Styling on Wordpress Sites

Okay. I've been dealing with some internal style issues on my Wordpress website. After dedicating hours to trying to change styles for various elements, I realized that the main html file contained a bunch of internal style sheets that were overridin ...

Error in Jquery click event not detecting the correct value

My function is designed to add or remove items from a SQL database upon click. I use a condition to differentiate between adding and removing, but while the add function works perfectly, the remove function does not, even though they share the same code. ...

Challenges associated with utilizing img src in JavaScript

I am facing a simple issue. I have carInfo data retrieved from a JSON file, but I am struggling to correctly parse the img source stored in the variable $imgsrc instead of treating it as a string called "$imgsrc". This data needs to be appended to my HTML ...

The menu shifts position or overlaps next to the current active menu option

It would be helpful to take a look at the URL provided (http://ymm.valse.com.my/) in order to understand my question better. Upon clicking on any menu item, I noticed that the menu next to the active tab overlaps. I believe the issue lies in the width pro ...

When inserting the HTML of a webpage into an iframe, the displayed content may vary slightly from the original page

I am facing an issue with my webpage where I extract the html, transmit it via websockets using socket.io to another page containing an empty iframe, and then inject the html dynamically into the iframe. My code for injecting the html looks like this: fr ...

Tips for vertically aligning <p> and <div> elements without using the table-cell property

I am trying to align my text vertically in the middle using a ch-grid <div> (the circle color element). Is it possible to achieve this without specifying a display attribute for the <p> element? I plan to hide it by setting display:none initia ...

Creating consistent div sizes for varying image and title lengths in bootstrap

In my angular project, I am receiving data in the form of image, title, and location. Despite my efforts to create a responsive div, I have been unsuccessful in achieving uniform sizes. <div *ngFor="let company of companies" class=" ...

Utilizing jQuery for manipulating href attributes

Having some trouble with a jQuery selector to click on a link. Any suggestions or solutions? Thanks in advance. $tweet.html(tweet.created_at + ' <a href="#" class="'+tweet.user+'">@' + tweet.user + '</a>: ' + twee ...

What is the most effective way to retrieve the children and ID of an item in the jQuery Nestable plugin following a drag-and-drop action,

I'm currently implementing the jQuery Nestable plugin to build a menu editor for a website. After users click on menu items and rearrange their positions, I need to retrieve the item's ID and its Children.   Challenge: I'm struggling with ...

Splitting with Regex - One Time Operation

Here is some of my Jquery code along with Regex: $("[class^=ipsum-img],[class^=ipsum-img-]").each(function(){ var x = $(this).attr("class"); console.log(x.length); if (x.length>8) { var m = x.split(/(\d+)[^-]*$/g); cons ...

Adding data from PHP into a designated div element

update: After some trial and error, I managed to find a solution using jQuery and append() methods. From my PHP code, I created an array containing all the necessary information that I wanted to insert into the tab divs. I then encoded this array into JSON ...

Achieving consistent margins across various browsers for UL elements

UL element margins are the same, but Firefox and IE are displaying differently. FULL CODE: <html> <head> <style> body { background-color: Red; } ul ...

Create an HTML component that expands to fill any leftover space on the page, without using flex

In my current situation, I have two elements positioned side by side with dynamic widths based on their content. The element on the right needs to fill up as much vertical space as possible without a set width. I am looking for an alternative to flexbox d ...

What is the best way to add a right-hand side navigation bar without blocking the scrollbar from view?

Take a look at this webpage: I am designing a website that includes a header, a footer, and a central container with left and right navigation bars surrounding a content area. However, I want the scrollbar for the content to appear on the right side of th ...

Margin discrepancies when using em units

Currently, I am utilizing an em-based margin for items within a menu that are homogeneous in terms of markup, class, and id. It appears that the margins for each of these items should be rendered the same. However, some are displaying as 1px while others a ...

Unable to activate slideToggle due to malfunctioning links

When using the slideToggle function, I encountered an issue where the links are not functioning properly. Check out my demo site at the following link: Here is my script: $(".nav li > a").click(function(e) { $(this).parent().siblings().find(&a ...

Displaying altered textContent

I am working with an SVG stored as a string and making some adjustments to it. The final result is being displayed as text within targetDiv. <html lang="en"> <head> <title>Output Modified</title> </head> <body> ...

Tips on maximizing the efficiency of ajax requests to MySQL databases

I have developed a website that needs to fetch data from a database every 2 seconds in order to display a dynamic market with changing prices and volumes. Below is the code I am using: $.ajax({ type: "get", url: "getData.php", data: { ...

Tips for retrieving values from numerous checkboxes sharing the same class using jQuery

Currently, I am struggling with getting the values of all checkboxes that are checked using jquery. My goal is to store these values in an array, but I am encountering difficulties. Can anyone provide me with guidance on how to achieve this? Below is what ...