Change the height of a division element after a script has been loaded

My web application is created using Bootstrap and Flask and it loads a Bokeh server document into a container div. The responsiveness of the Bokeh elements' size depends on a specific fixed initial height set for the containing div. This customization is done through a style.css file that includes my personalized CSS:

.placeholderbokehapp {
  height: 1500px;
}

Right after the content from Bokeh loads, I aim to increase the height of the .placeholderbokehapp to 1700px to make room for additional elements. When inspecting in Chrome DevTools Network tab, I notice the Bokeh content loading with an

autoload.js?bokeh-autoload-element=...
script, followed closely by jQuery and other necessary JavaScript files.

The following snippet represents the key contents in base.html:

<!doctype html>
<html lang="en"gt;
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

  <!-- Bootstrap CSS -->
  <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

  <title>{% block title %}Snowpack Tracker{% endblock %}</title>

  <link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">

  <link
    href="https://cdn.bokeh.org/bokeh/release/bokeh-1.0.4.min.css"
    rel="stylesheet" type="text/css">
  <link
    href="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-1.0.4.min.css"
    rel="stylesheet" type="text/css">

  <script src="https://cdn.bokeh.org/bokeh/release/bokeh-1.0.4.min.js"></script>  
  <script src="https://cdn.bokeh.org/bokeh/release/bokeh-widgets-1.0.4.min.js"></script> 

</head>

<body>

  <div class="container-fluid">
    {% block header %}{% endblock %}

    {% block content %}{% endblock %}

    {% block footer %}{% endblock %}

  </div>

  <!-- jQuery first, then Popper.js, then Bootstrap JS -->
  <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
  <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

</body>
</html>

Utilizing Flask, I render the given template:

{% extends 'base.html' %}

{% block header %}
{% include 'snowpacktracker/header.html' %}
{% endblock %}

{% block content %}
  <div class="placeholderbokehapp rounded" id="tbc-id">
        {{ wholebokehapp | safe }}
  </div>

{% endblock %}

{% block footer %}
{% include 'snowpacktracker/footer.html' %}
{% endblock %}

wholebokehapp pertains to the embedded Bokeh server document retrieved from a URL.

Answer №1

There is a potential alternative method that may yield better results

$($('.placeholderbokehapp').css('height', '1700px'))

Answer №2

If the Bokeh is loading inside an iframe HTML tag, one approach is to place a script at the end of the HTML page after all other JavaScript files have loaded.

<script>
    $('#tbc-id iframe').load(function(){
        $('#tbc-id').css({height: 1700}); // Set container height to 1700px        
       $(this).css({height: 1700}); // Match iframe height with the container

    });
</script>

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

Iterate through the form fields and save the information into an object

I am attempting to create a JavaScript object by looping through form inputs. const data = {}; // loop through each input found in form $('#form_name').filter(':input').each(function() { const $id = $(this).attr('id'); c ...

Incorporating payment processing into React Native using JavaScript

I am looking to incorporate payment processing into my react native app, but I encountered an issue with using RN's webview as it does not render on the web platform. Additionally, I need to be able to read the response from the server. Can someone re ...

Discover the initial two instances of a specific element within a collection of javascript objects

Within my javascript arraylist, I am currently storing the following elements: list = [ {header: "header1", code: ""}, {label: "label1", price: 10}, {header: "header2", code: ""}, {header: "header3", code: ""}, {header: "header4", code: ""} ] My que ...

Would it be appropriate to use require("fs") instead of require("node:fs") as a workaround in the OpenAI package?

I have inherited a project and am currently integrating OpenAI into it. Initially, I was informed to use Node 16, but after consulting with other developers on the project, I discovered that everyone is actually using version 14.17.3. The OpenAI package c ...

Creating a standard Modal component in Angular

I am trying to create a versatile Modal component. When the user clicks on the Add button, I want the modal to open with the functionality to add new content. Similarly, when the user clicks on the Edit button, I want the same modal to display edit functio ...

What is the method for generating an oval shape with a border-radius in CSS?

Is there a way to create an oval shape instead of a rectangle with rounded edges using CSS? Below is the code snippet I have been working with: div { position: fixed; border-radius: 25px; background: rgba(0,0,0,.5) width: 100px; height: 50px; ...

Highlight a pair of words in a phrase using jquery technology

Only one word in my code is highlighted $(document).ready(function() { let firstword = 'web'; let secondword = 'js'; $(".field.ConditionsAccept>.caption:contains('" + secondword + "'):contains('" + firstword ...

The error message "Encountered an issue when trying to access properties of undefined (reading 'getState')" was

Currently working on developing an app that utilizes a Django backend and React frontend. The goal is to enable users to log in, receive refresh and access tokens from Django, store the token in local storage, and redirect authenticated users to a static p ...

Using jQuery to smoothly transition the page: first fade out the current content, then switch the background

I'm currently facing an issue with trying to create a step-by-step operation that involves fading the container div around a target div, changing the background, and then fading it back in. The problem is that all the functions in this block are being ...

Leveraging node.js and express for incorporating custom stylesheets and scripts

I recently designed a webpage with the following elements at the beginning: <link href="./css/font-awesome.min.css" rel="stylesheet"> <link href="http://fonts.googleapis.com/css?family=Open+Sans:400italic,600italic,400,600" rel="stylesheet ...

combine two columns into a single responsive list group item

Using Bootstrap 4, I created an item list and divided it into two columns (see image). However, when I resized the website to a mobile size screen, it displayed like this: https://i.sstatic.net/0iPHm.png My desired outcome is for the list to display in o ...

Limit the API call to only respond to requests from the localhost

I'm currently working on a website that uses API calls within the same node project. I would like to restrict most of these API calls to only be accessible by the localhost website. Is there a way to achieve this without implementing OAuth and simply ...

Importing a JSON or JSONC file into a vite/typescript project can be easily done

I am looking for a way to seamlessly share my routes between my actix-web backend and Vue with Vue-Router frontend without needing separate route files. I want to define the routes on the frontend without having to make any changes on the server side. If t ...

Trouble with React Material-UI Select component onChange event

I encountered an issue while using Material-UI select where I am unable to access the selected value due to a warning message: index.js:1 Warning: findDOMNode is deprecated in StrictMode. findDOMNode was passed an instance of Transition which is inside S ...

Transforming a pair of lists into JSON format

I'm currently working on converting two lists into JSON format. Let's take a look at an example: list1 = ['a','b','a'] list2 = ['q','r','s'] The conversion should result in: [{ " ...

Issue with Knockout.js: Parsing error in bindings - SyntaxError: Unexpected token `};`

Take a look at this example. I've tried to simplify it as much as possible, but I'm still struggling to figure out where I went wrong. Any help would be greatly appreciated )) P.S Stack Overflow requires code, not just a link to jsfiddle. H ...

The require() function is not functioning properly, even after I tried switching the type from module to common. As a newcomer to this, there may be something essential that I

Despite changing the type from module to common, I am still unable to get require() to work. As a newcomer to this, there may be something I'm overlooking that I can't quite pinpoint. I attempted const express = require('express'); but ...

Retrieve data from input fields using an array

I am currently developing a form that allows users to add multiple inputs like so: <script type="text/javascript"> <!-- var counter = 0; var limit = 4; window.onload = moreFields; function moreFields() { if (counter == limit) ...

Constructing Django forms for displaying form fields from multiple models arranged based on a foreign key

I've hit a roadblock with this issue - despite trying various approaches, I keep encountering a "too many values to unpack" error upon form submission. Here's a brief overview of the models involved in this scenario: class Supplier(models.Model ...

Optimal Technique for Arranging ASP.NET Panels in a Side-by-Side Layout

Seeking advice on optimal method to align multiple containers horizontally next to each other rather than stacking them vertically. Some sources recommend using style="float:left;" while others propose utilizing style="display:inline;", which has been inef ...