5

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 1

4
<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>
2
  • 2
    I guess you mean $("#map") instead of $("#map) right? Commented Sep 26, 2018 at 16:26
  • Yes. Thanks. Updated. Commented Oct 14, 2018 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.