Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive view #8

Closed
wobsoriano opened this issue Mar 26, 2020 · 8 comments
Closed

Responsive view #8

wobsoriano opened this issue Mar 26, 2020 · 8 comments

Comments

@wobsoriano
Copy link

Is there an easy way to make the container responsive? Currently when you resize the window, the globe stays in its place.

Any help would be much appreciated.

@wobsoriano
Copy link
Author

This is the website btw https://covid-3d.now.sh

@vasturiano
Copy link
Owner

@sorxrob nice implementation! I've made a similar one at https://observablehq.com/@vasturiano/corona-virus-covid-19-globe

Regarding making it responsive, you can do that by manipulating the width and height properties. And if you prefer you can use something like element-resize-detector to detect changes to your window size.

@wobsoriano
Copy link
Author

@sorxrob nice implementation! I've made a similar one at https://observablehq.com/@vasturiano/corona-virus-covid-19-globe

Regarding making it responsive, you can do that by manipulating the width and height properties. And if you prefer you can use something like element-resize-detector to detect changes to your window size.

Nice! Thanks for the API. I'm still checking how to set the width/height dynamically in your docs. Thanks!

@wobsoriano
Copy link
Author

Adding this made it responsive. Thank you.

window.addEventListener('resize', (event) => {
  world.width([event.target.innerWidth])
  world.height([event.target.innerHeight])
});

@snshn
Copy link
Contributor

snshn commented Jun 22, 2021

Ah, perfect, thank you so much @wobsoriano!

@kqwq
Copy link

kqwq commented Jan 1, 2022

thanks so much @wobsoriano

@chavinlo
Copy link

chavinlo commented Jan 1, 2023

Thanks @wobsoriano

@ralyodio
Copy link

i get a flash of white when i resize. how do i fix this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants