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.