Ways to adjust iframe height as it loads

$('#song-link').change(function () {
  var link = $('#song-link').val();
  SC.oEmbed(link, {
    element: document.getElementById('putTheWidgetHere')
  });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://connect.soundcloud.com/sdk/sdk-3.1.2.js"></script>
<input  id="song-link" placeholder="Paste Soundcloud link here" name="song_link"   type="text">
<div id="putTheWidgetHere"></div>

Experiencing an issue with adjusting the height of the Soundcloud link preview. Attempted using addClass() and css() methods but to no avail. Looking to change the height from 400px to 200px.

Struggling to identify the event that triggers these functions as the height adjustment should occur after the Soundcloud link is pasted into the input text field and loads in the iframe that Soundcloud utilizes.

Answer №1

Check out this solution:

#widgetContainer iframe {
    min-height: 200px;
    height: auto;
}

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

Border becomes dashed when dragging and dropping

I am working on enabling drag and drop functionality for users. When an item is lifted from its original position, a gray dashed box should appear in its place. As the item is moved closer to another spot, the containers adjust to create a target area (gra ...

Which UL should be selected next?

I am facing an issue with a trigger that is meant to target the next UL element and apply effects to it. <div id="archives_trigger"><a class="menu_trigger">Monthly Archives</a></div> <ul id="archives_menu"> <?php wp_ ...

How can Django implement dynamic CSS for a single item that changes its background dynamically?

I am looking to create a single CSS style that can dynamically change its background based on a Django variable. This becomes more challenging when dealing with a:hover. The initial static style.css code appears as follows: .titles-button h2 a { marg ...

How can I prevent dataTable resizing?

Is there a solution to prevent datatable resizing? For instance, when the default number of rows per page in the datatable is set to 10 rows. If you input 13 rows into the datatable, it will be divided into 2 pages - with 10 rows on the first page and 3 ro ...

Issue encountered while trying to define a global variable within a JavaScript Class

I'm currently working on setting up a page variable that can be utilized by my Scroller class for implementing infinite scrolling. It's crucial for this variable to have global scope, as it needs to retain its value outside of the ajax function. ...

What is the best way to extract information from a .txt file and transform it into an integer format?

I am currently working on a project involving a distance sensor that retrieves data from a Raspberry Pi and displays it on a website. The goal is to have the data stored in a .txt file and then transferred to the website for display. I am seeking assistanc ...

Issues with Bootstrap integration in Visual Studio causing problems

I'm encountering an alignment issue when using Bootstrap in Visual Studio, specifically with Bootstrap columns. When I use a div with the class col-md-4, it automatically adds some space to the right and doesn't align properly. However, when I wr ...

Adjusting image size as you scroll

Hello everyone, I am currently working on coding a website logo that decreases in size as the user scrolls down, similar to the effect seen on this website: . I am relatively new to HTML and was wondering if there are any specific commands or techniques th ...

Designing a book-style layout using jQuery

I am currently working on a web application that needs to display its data in a book-like format. The structure of the data is as follows: Menu{ String menuName; List<String> subMenu; } To achieve this, I utilized jQuery to dynamically generate ...

perform an action in PHP when a button is clicked

I'm currently developing a PHP admin panel that displays a list of users in an HTML table format. Each row in the table includes a button that allows the admin to send a notification to the selected user. Below is the code I used to create and displa ...

The 'data-intro' property cannot be bound to the button element as it is not recognized as a valid property

I've been using the intro.js library in Angular 8 and so far everything has been working smoothly. However, I've hit a roadblock on this particular step. I'm struggling to bind a value in the data-intro attribute of this button tag. The text ...

Creating an Eye-catching Presentation: Tips for Adding Text to Your CSS3 Slideshow

I am currently in the process of creating a CSS3 slideshow with text for each image. I found inspiration from this example: . However, I made some modifications to make it responsive. Here is the HTML code I have used: <div id="slideshow"> < ...

Having trouble with your Bootstrap 4 Dropdown Menu?

I attempted to implement the dropdown menu example from Bootstrap 4, but unfortunately it does not seem to be working as expected. The dropdown menu does not appear when clicked. <li class="nav-item dropdown"> <a class="nav-link dropdown-to ...

The scrollTop feature fails to function properly following an Axios response

I'm currently facing a challenge with creating a real-time chat feature using Laravel, Vue.js, Pusher, and Echo. The issue arises while implementing the following 3 methods: created() { this.fetchMessages(); this.group = $('#group') ...

Creating a list of font sizes for each <p> tag in my HTML document

I am looking to create an array containing the font sizes of all the p tags in my HTML document. How can I specifically target only the p elements and not their parent elements? ...

What is the layout of JqueryMobile web pages like?

When I need to pull pages, I use Asp.net MVC. The format of my pages is as follows: { Layout = ""; } <div data-role="page"> .... <script type="text/javascript"> $(document).one("pageinit", function () { . ...

Get connected to your favorite music on iTunes without the hassle of opening a new window by simply clicking on the

Is there a way to call a link to iTunes (itms://...) without opening a new window? I've tried using window.open but that just opens a new window. Also, $.get('itms://...'); doesn't seem to work for me. Are there any other options avail ...

Utilize Ajax and Django to inject context into a template

I'm facing a challenge with displaying data from multiple sources in one view. My plan is to use Ajax, as loading 3 or 4 URLs simultaneously on page load is not feasible. Through the Django Rest Framework, I've managed to fetch the data and see ...

Functionality of jQuery Mobile Page

$(document).on("pageshow", "#mappage", function (event) { $("#doldur").append("<li> <label onclick='getBina(" + featuressokak[f].attributes.SOKAKID + ");'>" ...

Extract the content of an element and incorporate it into a script (AddThis)

HTML: <div id="file-section"> <div class="middle"> <p class="description"> Lorem ipsum... </p> </div> </div> jQuery: var share_on_addthis = { description: $('#file-section ...