Search code examples
jquery-mobilejquery-ui-mapgoogle-maps-styling

Change the style of a Styled Google Map


I want to change the style of my Google Maps. I am using jQuery-UI-Map, but I can't figure out how.

Here's the code I am using right now:

$(document).ready(function(){
    $("#changeMap").click(function(){
        alert('About to change style...');
        $('#map_canvas').gmap({styles: mapStyleRed});
    });
});

The message box is being fired, but the map is not being updated to my "mapStyleRed".


Solution

  • It's always nice to find the answer a few minutes after posting a question...

    $(document).ready(function(){
        $("#changeMap").click(function(){
            alert('About to change style...');
            $('#map_canvas').gmap('get','map').setOptions({styles: mapStyleRed});
        });
    });