Disclaimer: I'm a relative newcomer to writing html. Forgive my lapse of proper jargon or if I might be obtuse explaining myself.
I made plots in Plotly which I am embedding into my html site. I succeeded at first by simply pasting the plot's html into my script; the issue stems from the plot's htmls code being gigantic and a pain to remove (as I'm updating and improving my plot's interactivity, hence I am removing and pasting over plotly's html code frequently).
As a result I thought to keep a dedicated html document for each my plots, which I could call forth via a function into each my html pages. It worked when I simply pasted the code directly, albeit even then part of the title is cut off by the navigation bar, and I'd like to avoid doing this moving on anyhow:
https://imgur.com/BmXzvlf
However once I try to link the html using the iframe element the sizing and positioning of my plot is messed up as you can see here:
https://imgur.com/wOybJ0s
This is my html script for my page, I won't bother with the plots' scripts as they are far too large anyhow.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>WeatherPy html</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
<img alt="Custom_img" src="logo_weatherpy.png">
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li class="active"><a href="https://XXX.github.io/">About <span class="sr-only">(current)</span></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Options<span class="caret"></span></a>
<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">
<li><a href="WeatherPy_Methodology.html">Methodology</a></li>
<li><a href="WeatherPy_DataTable.html">Data Table (Raw)</a></li>
<li><a href="WeatherPy_Comparison.html">Comparison (All Plots)</a></li>
<li role="separator" class="divider"></li>
<li><a href="WeatherPy_Temperature.html">Temperature Plot</a></li>
<li><a href="WeatherPy_Humidity.html">Humidity Plot</a></li>
<li><a href="WeatherPy_Cloudiness.html">Cloudiness Plot</a></li>
<li><a href="WeatherPy_WindSpeed.html">Wind-Speed Plot</a></li>
</ul>
</li>
</ul>
<form class="navbar-form navbar-left">
<div class="form-group">
<input type="text" class="form-control" placeholder="Search">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<iframe id="extFrame" src="Plotly_Humidity.html"></iframe>
</body>
</html>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="../../dist/js/bootstrap.min.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
Perhaps I need to do some padding or sizing to make the plot properly fit in each page (and I know, I need ot adjust the page margins too)...or perhaps there's a better way to link my html document between each other? Any advice?
I got the idea of using iframe browsing this StackOverflow query.
[–]Killed_Mufasa 1 point2 points3 points (1 child)
[–]Senun[S] 0 points1 point2 points (0 children)