I have a google map integrated on part of my page. I would like to create a toggle button to toggle the map between full screen and normal size. So when you click on it - the map extends to fill the whole browser screen, and click on it again, it is restored to its original size on the page. How would I do it?
Here's a jQuery implementation.
$("#map_toggler").click(function() {
  $("#map").toggleClass("fullscreen")
});
In the CSS:
#map {
  width: 400px;
  height: 200px;
}
#map.fullscreen {
  position: fixed;
  width:100%;
  height: 100%;
}
Untested, but something along the lines of that should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With