It is just an answer, as I could not find the answer myself, so wrote it for community. Some commented out code to play with too.
1 Answer
<div id="map"> </div>
<script type="text/javascript">
function getMapHeight() {
return (window.innerHeight - 90);
}
$(function () {
let options = {
autoResize: true,
// width: '100%',
height: getMapHeight() + "px",
};
let network = new vis.Network($("#map"), data, options);
$(window).on('resize', function(){
network.setOptions({
// width: (window.innerWidth - 100) + "px",
height: getMapHeight() + "px",
});
});
});
</script>
-
2I guess you mean
$("#map")
instead of$("#map)
right? Commented Sep 26, 2018 at 16:26 -