markmarkoh / datamaps

Customizable SVG map visualizations for the web in a single Javascript file using D3.js
http://datamaps.github.io
MIT License
3.78k stars 1.01k forks source link

Responsive map resizing in every browser but internet explorer. #252

Open dvolz opened 8 years ago

dvolz commented 8 years ago

responsive: true

and

window.addEventListener('resize', function() { map.resize(); });

are being called. Is this a known issue or am I possibly doing something wrong?

ifedapoolarewaju commented 8 years ago

this might have been fixed here https://github.com/markmarkoh/datamaps/pull/235 already

ifedapoolarewaju commented 8 years ago

also while waiting for the release of the new version, here's what I did to solve it in my project

$(window).on('resize', function() { var newsize, oldsize, options; options = map.options; newsize = options.element.clientWidth; oldsize = d3.select(options.element).select('svg').attr('data-width'); return d3.select(options.element).select('svg').selectAll('g').attr('transform', 'scale(' + (newsize / oldsize) + ')'); })

dvolz commented 8 years ago

much thanks @andela-oifedapo! That worked like a charm.