# toggle

return type | undefined
syntax | $( map or service selector ).geomap( "toggle" [ , Boolean show_or_hide ] )

usage

    $("#map").geomap( "toggle" )
    $("#map .osm").geomap( "toggle", false )

This method toggles or sets the visibility property of service objects in the services array.

If you call toggle directly on geomap's div element, it will apply to all services. You can target individual services using a CSS selector based on the map div id and the class supplied for the service in its service object or just the id of the service if supplied in its service object.

    // for example, given the following as the map div
    <div id="map"></div>

    // and initializing geomap with the following services
    $("#map").geomap({
      services: [
        {
          id: "water",
          class: "mass-gis",
          type: "shingled",
          src: function ( view ) { return null; }
        },
        {
          id: "towns",
          class: "mass-gis",
          type: "shingled",
          src: function ( view ) { return null; }
        },
        {
          id: "harbor-cruise",
          type: "shingled",
          src: function ( view ) { return null; }
        }
      ]
    });

    // you can later hide all services
    $("#map").geomap("toggle", false);

    // all mass-gis services
    $("#map .mass-gis").geomap("toggle", false);

    // or a specific service
    $("#harbor-cruise").geomap("toggle", false);

If the optional boolean value is not supplied, the visibility of the services will be toggled.

The change will happen immediately and you do not need to call refresh. This is recommended over manually changing the visibility property of the service object as it does not cause other services to refresh.