Bonjour.

Ces jours ci je développe une map pour un projet à mon taf.
Le seul problème, c'est que je n'arrive pas à obtenir une InfoWIndow comme celle de base que l'on trouve sur google maps :


J'aimerais donc avoir une popup comme celle-ci, et après j'aimerais juste personnaliser si possible le texte présent à l'intérieur.

voici mon code :
html :
Code html : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<article id="agency-localization">
    <h2>IMPLANTATION GEOGRAPHIQUE</h2>
    <span class="sub-title">Veuillez sélectionner une agence, svp.</span>
    <div id="agencies-list"></div>
    <div id="agencies-map-canvas"></div>
</article>

JavaScript :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
var MyAgencies = {
 
    mapOptions: { },
    map: null,
    geocoder_map: null,
    infowindow: null,
    markerBounds: null,
    markersArray: [],
 
    init: function () {
 
        var AgenciesDataSource = [];
        AgenciesDataSource.push({ AgencyID: 'F726AA0A-B9A7-4952-8D33-F90FAA7BABC7', Name: '', Address: '', PostalCode: '', Localization: '', Country: 'France', Phone: '', Fax: '', Email: '' });
        AgenciesDataSource.push({ AgencyID: 'A423EF8C-A5CE-4473-86A0-CA25A62C23FE', Name: '', Address: '', PostalCode: '', Localization: '', Country: 'France', Phone: '', Fax: '', Email: '' });
 
        /*******************************************************************************
         * Elements
         ******************************************************************************/
        var Agencies = $("div#agencies-list").accordion();
        var map_cancas = document.getElementById("agencies-map-canvas");
 
        /*******************************************************************************
         * Gmap
         ******************************************************************************/
        this.mapOptions = {
            center: new google.maps.LatLng(49.4431, 1.1025),
            zoom: 9,
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };
 
        this.map = new google.maps.Map(map_cancas, this.mapOptions);
        this.geocoder_map = new google.maps.Geocoder();
        this.infowindow = new google.maps.InfoWindow();
 
        /*******************************************************************************
         * Agencies - Accordion
         ******************************************************************************/
        $.each(AgenciesDataSource, function (index, Agency) {
            var AgencyTemplate = '<h3>' + Agency.Name + " " + Agency.Localization + '</h3>' +
                                '<div>' +
                                    '<input type="hidden" name="AgencyID" value="' + Agency.AgencyID + '" />' +
                                    '<p>' +
                                        '<span>' + Agency.Address + '</span>' +
                                        '<span>' + Agency.PostalCode + ' ' + Agency.Localization + '</span>' +
                                        '<span>' + Agency.Country + '</span>' +
                                        '<span>Tél : ' + Agency.Phone + '</span>' +
                                        '<span>Fax : ' + Agency.Fax + '</span>' +
                                        '<span>Email : ' + Agency.Email + '</span>' +
                                    '</p>' +
                                '</div>';
            Agencies.append(AgencyTemplate);
        });
        Agencies.accordion("refresh")
            .accordion("option", "active", 0)
            .on("accordionactivate", function (event, ui) {
                var AgencyID = ui.newPanel.find("input[type='hidden'][name='AgencyID']").val();
                $.each(AgenciesDataSource, function (index, Agency) {
                    if (Agency.AgencyID == AgencyID) {
                        MyAgencies.DisplayAgency(Agency);
                        return false;
                    }
                });
            });
 
        /*******************************************************************************
         * Multiselect
         ******************************************************************************/
        /*Agencies.bind('change', function (e) {
            var SelectedAgencies = Agencies.dataItems();
 
            // delete every marker
            MyAgencies.DeleteOverlays();
 
            // come back to the original position
            var IsThereLocations = (SelectedAgencies.length > 0);
            switch (IsThereLocations) {
                case true:
                    MyAgencies.ClearMarkerBounds();
                    break;
 
                case false:
                    MyAgencies.DefineDefaultBound();
                    break;
            }
 
            $.each(SelectedAgencies, function (index, SelectedAgency) {
                MyAgencies.AddMaker(SelectedAgency.Address, function () {
                    MyAgencies.ShowOverlays();
 
                    if (SelectedAgencies.length == 1) {
                        MyAgencies.map.setZoom(14);
                    }
                });
            });
        });*/
 
    },
 
    /*******************************************************************************
     * Gmap
     ******************************************************************************/
    DisplayAgency: function (Agency) {
        // delete every marker
        MyAgencies.DeleteOverlays();
 
        // come back to the original position
        MyAgencies.ClearMarkerBounds();
 
        MyAgencies.AddMaker(Agency, function () {
            MyAgencies.ShowOverlays();
            MyAgencies.map.setZoom(13);
        });
    },
 
    /*******************************************************************************
     * Marker
     ******************************************************************************/
    AddMaker: function (Agency, Callback) {
        var $that = this;
        var location = Agency.Address + ", " + Agency.PostalCode + ", " + Agency.Localization + ", " + Agency.Country;
        var AgencyTemplate = '<div class="gmap-tooltip">' +
                                '<h3>' + Agency.Name + " " + Agency.Localization + '</h3>' +
                                '<div>' +
                                    '<input type="hidden" name="AgencyID" value="' + Agency.AgencyID + '" />' +
                                    '<p>' +
                                        '<span>' + Agency.Address + '</span>' +
                                        '<span>' + Agency.PostalCode + ' ' + Agency.Localization + '</span>' +
                                        '<span>' + Agency.Country + '</span>' +
                                        '<span>Tél : ' + Agency.Phone + '</span>' +
                                        '<span>Fax : ' + Agency.Fax + '</span>' +
                                        '<span>Email : ' + Agency.Email + '</span>' +
                                    '</p>' +
                                '</div>'
                            '</div>';
 
        this.geocoder_map.geocode({ 'address': location }, function (results, status) {
            var IsMarkerAccepted = (status == google.maps.GeocoderStatus.OK);
            switch (IsMarkerAccepted) {
                case true:
                    var marker = new google.maps.Marker({
                        position: results[0].geometry.location,
                        map: this.map
                    });
                    $that.markersArray.push(marker);
                    MyAgencies.AddMarkerBound(results[0].geometry.location);
 
                    // tooltip
                    $that.infowindow.setContent(AgencyTemplate);
                    $that.infowindow.open($that.map, marker);
                    google.maps.event.addListener(marker, 'click', function () {
                        $that.infowindow.open($that.map, marker);
                    });
 
                    Callback();
                    break;
 
                case false:
                    alert("Geocode for " + address + " was not successful for the following reason: " + status);
                    break;
            }
        });
    },
 
    ClearOverlays: function () {
        if (this.markersArray !== undefined) {
            for (i in this.markersArray) {
                this.markersArray[i].setMap(null);
            }
        }
    },
 
    ShowOverlays: function () {
        if (this.markersArray !== undefined) {
            for (i in this.markersArray) {
                this.markersArray[i].setMap(this.map);
            }
        }
    },
 
    DeleteOverlays: function () {
        if (this.markersArray !== undefined) {
            for (i in this.markersArray) {
                this.markersArray[i].setMap(null);
            }
            this.markersArray.length = 0;
        }
    },
 
    /*******************************************************************************
     * Marker Bounds
     ******************************************************************************/
    AddMarkerBound: function (location) {
        this.markerBounds.extend(location);
        this.map.fitBounds(this.markerBounds);
    },
 
    ClearMarkerBounds: function () {
        this.markerBounds = new google.maps.LatLngBounds();
    },
 
    DefineDefaultBound: function () {
        this.markerBounds = new google.maps.LatLngBounds();
        MyAgencies.AddMarkerBound(this.mapOptions.center);
        this.map.setZoom(this.mapOptions.zoom);
    }
 
};
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
$(document).ready(function () {
 
    MyAgencies.init();
 
            });
pourriez-vous me dire ce qui cloche svp ? j'ai cherché tout la journée d'hier, sans résultat :/.
les informations à l'intérieur de mon Json ont été effacées volontairement, le problème ne vient donc pas de là .
Merci