Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialBoris Kamp
16,660 PointsChange Google Maps JS Api's styles based on zoom level
Hi guys!
I'm using the Google Maps JS API in order to display a customised maps on my client's site. I set the stroke weight to '2', however, when zoomed out to a certain level, the stroke gets to heavy. How can I change this weight based on the zoom level?
I've made a start with the help of another question but am stuck, here my code so far:
google.maps.event.addListener(map, 'zoom_changed', function() {
var zoom = map.getZoom();
if (zoom <= 20) {
// change the road.highway stroke weight to '2';
} else {
// change the road.highway stroke weight to '1';
}
});
does anybody have a clue on how to do this?