Google maps api

How to add custom control in google maps v3 using jquery?

+3
source share
2 answers

You need to bind custom controls to the functions that you want to execute on the map itself, but to add a custom control using jQuery to control the DOM, follow these steps:

$(function () {
    var myOptions = {
        ...

        mapTypeControl: false
    }

    map = new google.maps.Map($mapDiv, myOptions);

    ...


    // Remove the custom control from the DOM to memory
    $control = $(".myControlSelector").detach();

    // Push the control to the top right position on the map
    map.controls[google.maps.ControlPosition.TOP_RIGHT].push($control[0]);
});

More documentation is here: http://code.google.com/apis/maps/documentation/javascript/controls.html#CustomControls

+7
source

, jQuery Google Maps, . " " .

Android- jQuery ( , // ).

+1

Source: https://habr.com/ru/post/1789506/


All Articles