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

Method to set position of zoom buttons? #96

Open
bean-frog opened this issue Jun 13, 2023 · 1 comment
Open

Method to set position of zoom buttons? #96

bean-frog opened this issue Jun 13, 2023 · 1 comment

Comments

@bean-frog
Copy link

Hello! Having a great experience with svgMap so far, just wondering if there is an option i can pass when I initialize the map that would move the little menu with the zoom controls to a different corner or position? or would I have to wait for the map to load then move it with JS.

@bean-frog
Copy link
Author

Here's a very rudimentary JS method to do this. On my project, the map is loaded on DOM load, so if you're seeing this and your map doesn't do that you'll need a mutation observer or call the function after your map is created.

document.addEventListener('DOMContentLoaded', function() {
    const zoomControl = document.querySelector('.svgMap-map-controls-wrapper');
    if (zoomControl) {
      zoomControl.style.right = '0';
      zoomControl.style.left = 'unset';
    }
  });

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

1 participant