Newer
Older
indexation / public / js / resize.js
(function() {
  var container = d3.select("#container");

  var widthWindow = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
    heightWindow = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
  container
    .style("height", Math.round(heightWindow / 1.5) + 'px')
    .style("width", Math.round(widthWindow / 1.5) + 'px')
    .attr("height", Math.round(heightWindow / 1.5))
    .attr("width", Math.round(widthWindow / 1.5));

  d3.select(window)
    .on("resize", function() {
      var widthWindow = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
        heightWindow = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
      container
        .style("height", Math.round(heightWindow / 1.5) + 'px')
        .style("width", Math.round(widthWindow / 1.5) + 'px')
        .attr("width", Math.round(widthWindow / 1.5))
        .attr("height", Math.round(heightWindow / 1.5));
    });
})();