1. Home >
  2. Documentation >
  3. Misc >
  4. exec
 

exec

This function allows to apply a function on each object selected.

Usage

Parameters

  • get parameters
  • func {function(data)|array of function(data)} Function to apply
    • data {object} Object merged with user objet configuration
      • object {object} Google Maps object
      • user configuration

Note

  • exec perform a get and then apply the specified function on each object selected

Example

$('#test').gmap3({
    map:{
      options:{
        center:[46.578498,2.457275],
        zoom: 5
      }
    },
    marker:{
      values:[
        {latLng: [48.8620722, 2.352047], tag:"green"},
        {latLng: [46.59433,0.342236], tag:"green"},
        [42.704931, 2.894697],
      ]
    }
  });
  
  setTimeout(function(){
    $('#test').gmap3({
      exec: {
        tag:"green",
        all:"true",
        func: function(data){
          // data.object is the google.maps.Marker object
          data.object.setIcon("http://maps.google.com/mapfiles/marker_green.png")
        }
      }
    });
  }, 2000);
Close