Gmaps (Google Maps) addon

Gmaps - Manually show/hide markers

Amsterdam Rotterdam Den-Haag

ExpressionEngine Code
 Amsterdam 
  Rotterdam 
 Den-Haag 


{exp:gmaps:init}
{exp:gmaps:map 
    width="100%"
    center:address="holland"
    zoom="9"
}
    {gmaps:add_marker
        address="amsterdam"
        keys="amsterdam"
    }
    {gmaps:add_marker
        address="rotterdam"
        keys="rotterdam"
    }
    {gmaps:add_marker
        address="den-haag"
        keys="den-haag"
        }
{/exp:gmaps:map}


$(function(){
    $('.checkbox').click(function(){

        //show marker
        if($(this).is(':checked')) {
            EE_GMAPS.api('showMarker', {
                mapID : 'ee_gmap_1',
                key : $(this).val()
            }); 
        //hide
        } else {
             EE_GMAPS.api('hideMarker', {
                mapID : 'ee_gmap_1',
                key : $(this).val()
            });    
        }
    });
});