jQuery Store Locator toont verkeerde afstand

Overzicht Reageren

Sponsored by: Vacatures door Monsterboard

Lead developer

Functie Als lead developer wordt jij verantwoordelijk voor een van onze development teams. Samen met de Software Architect bewaak jij de kwaliteit en uitvoering van onze complexe vraagstukken. Daarnaast ben jij verantwoordelijk voor het inschatten, designen en ontwikkelen van middelgrote tot grote veranderingen in de software. Ook coördineer jij het proces rondom complexe technische vraagstukken. Verder bestaat jouw takenpakket uit het volgende: – Het aansturen van jouw development team; – Het begeleiden van Junior Software Engineers; – Het maken van technische analyses m.b.t. nieuwe aanvragen en het tijdsbestek inschatten voor de uitvoering hiervan; – Het uitvoeren van de ontwikkeling van

Bekijk vacature »

Front end developer

Functie Qua type opdrachten is er echt een verscheidenheid aan afnemers, zo werken ze met grote multinationals, maar ook met startups. Zo kom je te werken in een gevarieerde omgeving en kan je ook schakelen tussen verschillende culturen. De projecten variëren van greenfield projecten tot langdurige ontwikkeltrajecten. Hier wordt alleen maar gewerkt met aan front end projecten. Daarom maakt het onze partner niet uit waar jij kennis van hebt, als je maar gedegen kennis hebt van Javascript frameworks, Unit testing en ook bekend bent met de scrum methodiek. Eisen Minimaal 4 jaar relevante werkervaring Kennen en ervaring van Javascript frameworks

Bekijk vacature »

Python Developer

Dit ga je doen Als Python Developer ben je verantwoordelijk voor: Het ontwikkelen van Stuurprogramma's in Python zodat er verbindingen kunnen worden gelegd tussen besturingssystemen en (AV) hardware; Het testen en debuggen van Stuurprorgamma's; Het communiceren met noodzakelijke partijen in gevallen waar extra technische details nodig zijn om een Stuurprogramma te ontwikkelen of problemen op te lossen; Het maken van de nodige technische documentatie (in het Engels); Het participeren in een Scrum/Agile omgeving. Hier ga je werken Deze internationale organisatie is wereldwijd een succesvol producent en leverancier van professionele AV hard- en software. Klanten gebruiken de producten o.a. voor het

Bekijk vacature »

Ambitieuze medior developer

Wat je gaat doen: Heb jij al een paar jaar ervaring als developer maar wil jij naar the next level? In ons NextLevelDev Programma helpen wij jou om de volgende stap te zetten: een mooi programma aan trainingen op het gebied van Java, hippe frameworks, Agile/Scrum, OCP-certificering en optioneel: andere JVM-talen als Kotlin en Scala; Cloud (AWS, Azure, GCP) Soc Of beter nog, wat wil jij doen? Binnen DPA GEOS zijn we dan ook op zoek naar enthousiaste Java developers om ons development team te versterken. Als Java developer werk je in Agile/Scrum teams bij onze klanten en daarbij kun

Bekijk vacature »

Database Developer

Functieomschrijving Heb jij ongeveer 3 jaar ervaring als Database Developer met MS SQL of een vergelijkbare database? Wil jij werken voor een ambitieuze werkgever in regio Tilburg waar jij volledig de mogelijkheid krijgt jezelf te ontwikkelen? Lees dan snel verder! Hoe ziet jouw takenpakket eruit? Je gaat projecten gedurende het hele proces begeleiden. Je sluit aan bij afspraken met klanten om hun processen helder te krijgen. Vervolgens voer jij het project uit en zorgt dat dit zo goed mogelijk verloopt; Je werkt aan nieuwe softwareoplossingen die de logistieke processen verbeteren of vernieuwen; Je houdt je bezig met het ontwikkelen van

Bekijk vacature »

Senior PHP Developer

Als Senior PHP Developer bij Coolblue zorg je ervoor dat onze webshops elke dag een beetje beter zijn en coach je andere developers op de hard en soft skills. Wat doe je als Senior PHP Developer bij Coolblue? Als PHP Developer werk je met andere development teams samen om onze webshop zo optimaal mogelijk te laten werken en onze klanten blij te maken. Hoewel je een PHP Developer bent, sta je open om C# of Typescript in te zetten of te leren. Ook PHP Developer worden bij Coolblue? Lees hieronder of het bij je past. Dit vind je leuk om

Bekijk vacature »

Senior PHP developer

Functie Jouw werkzaamheden zullen grotendeels bestaan uit het in teamverband ontwerpen, vernieuwen en door ontwikkelen van het systeem. Het is echt back-end werk (bijvoorbeeld het doorontwikkelen van een API) en dit moet je dan ook liggen. Ze zijn niet persee gebonden aan talen of tools maar gebruiken graag de technieken die het beste aansluiten op de gegeven oplossing. Voor nieuwe (versies van) componenten maken ze veelal gebruik van Go(lang). Bij aanpassingen aan bestaande onderdelen gebeurt dit in PHP en C++. Het team is heel divers, er hangt een relaxte sfeer en ze organiseren regelmatig leuke music nights, game nights e.d.

Bekijk vacature »

Embedded Software Developer Games

Functie omschrijving Heb jij affiniteit met hardware en wil jij kleuren binnen een Qt framework? Spreek jij de talen C en of C ++? Dan ben ik wellicht opzoek naar jou! Voor een super gave opdrachtgever in omgeving Delft is er namelijk plek voor een nieuwe kracht! Dit bedrijf is gespecialiseerd in het ontwerpen van software voor een unieke game industrie. Wil jij betrokken worden bij een proces dat loopt van ontwikkeling tot installatie? Waarbij je bezig zult zijn met perfecte systemen die geleverd worden aan binnen en buitenland? Je zult in een team, samen met vier ontwikkelaars, de mooiste

Bekijk vacature »

Software Ontwikkelaar

Functieomschrijving In deze uitdagende functie als Software Developer ga je de volgende taken uitvoeren: Maatwerk back-end software programmeren; API koppelingen bouwen; Software optimaliseren voor klanten; Bouwen maatwerk applicaties; Werken met Microsoft stack zoals C#, .NET (Core) en Entity framework; Bedrijfsprofiel Je gaat werken bij een klein softwareontwikkelingsbureau, die maatwerk software bouwt voor klanten door heel Nederland. Dit doen zij al meer dan 20 jaar. Het is van oorsprong een familiebedrijf, opgezet door de eigenaar, die er nog steeds werkt. Het team bestaat vooral uit back-end developers en één systeembeheerder. Je krijgt veel kans om jezelf te ontwikkelen en krijgt tevens

Bekijk vacature »

Product Developer (M/F), Fulltime 40 h/week

A global Plantbased revolution – that is our dream. Maximising the protein transition – that is our mission. Producing and developing sustainable and delicious products – that is what we do. Ojah is a fast growing company with a mission and has the ambition to be the world leader in its field. To support this growth we are hiring new colleagues. People that would like to make a difference and dare to dream big. With currently a 150 colleagues proudly working on our exceptional products. Working in a dynamic surrounding that runs full speed ahead. We need you! Product Developer

Bekijk vacature »

No-Code Betty Blocks ontwikkelaar

Bedrijfsomschrijving Wil jij de bedrijfsprocessen van klanten revolutionair digitaliseren en optimaliseren zonder beperkt te worden door programmeertalen? Kom werken bij een snelgroeiende en professionele organisatie met een gezonde dosis humor en veel vrijheid om jezelf te ontwikkelen. Als No-Code Betty Blocks ontwikkelaar werk je vanuit ons kantoor in het hart van Nederland, je thuiswerkplek of op locatie bij de klant. We faciliteren de juiste trainingen en ondersteuning zodat je een echte Betty Blocks expert wordt. Naast het werk zijn er bij ons bijzondere events, zoals een jaarlijkse zeildag, een zomerse barbecue en een knus kerstdiner om de grillige maanden door

Bekijk vacature »

Experienced Lead Java Developer

Vacature details Vakgebied: Software/IT Opleiding: Senior Werklocatie: Delft Vacature ID: 13301 Introductie We are seeking a Lead Java Developer for our team in the area of Delft. You will develop an application used exclusively by the engineers and geologists for site characterizations, which imports raw field and laboratory measurements for further processing, integration, ground modelling, and geotechnical analysis and reporting. The client/server application is entirely written in Java, and the server is hosted in the Amazon cloud, utilizing frameworks such as Spring and Hibernate, and connected to an MS SQL Server RDS instance. There is a trend towards using more

Bekijk vacature »

OutSystems Developer

Dit ga je doen Het van scratch af aan ontwikkelen van applicaties met OutSystems; Het aanhaken bij diverse projecten binnen de organisatie; Schakelen met de business; Meedenken over de mogelijkheden van het platform binnen de organisatie. Hier ga je werken Deze organisatie is een toonaangevende speler in de vastgoedbranche en telt momenteel ruim 500 medewerkers. Met meer dan 150 applicaties staat er een complex applicatielandschap, bestaande uit standaard- en maatwerkapplicaties. De maatwerkapplicaties worden ontwikkeld door een inhouse development team. Het doel voor de komende periode is het verder vernieuwen en optimaliseren van het huidige applicatielandschap. Zo staat de organisatie aan

Bekijk vacature »

.Net Front-end Ontwikkelaar

Wij zoeken een .Net Front-end Ontwikkelaar! Omschrijving Kun jij snel schakelen en ben je stressbestendig? Dan zoeken wij jou! Als .Net Front-end Ontwikkelaar help je mee aan de webapplicatie die over de hele wereld door allerlei bedrijven wordt gebruikt. Je werkt daarnaast mee aan nieuwe en verbeterde functionaliteiten en helpt met het oplossen van bugs. Over de opdrachtgever Je komt te werken in een ambitieus team dat zich blijft ontwikkelen. Dit is alle informatie die we nu kunnen delen over de werkplek. Als jij de .Net Front-end Ontwikkelaar bent voor deze job, vertellen we je snel nóg meer. Eisen Heb

Bekijk vacature »

Laravel Developer

Functie omschrijving Voor een gave organisatie in de buurt van Den Bosch zoek ik een PHP developer. Het is van belang dat je kennis/ervaring hebt met het framework Laravel. Jij gaat in deze functie software applicaties ontwikkelen. Deze software projecten zijn heel divers, en deze organisatie maakt software, van A tot Z. Klanten kunnen in elke sector werkzaam zijn, van profit tot non-profit. Andere taken zijn onder andere: documentatie schrijven over applicaties/uitleg geven over software en applicaties/ klantcontact over bestaande applicaties/applicaties optimaliseren. Bedrijfsprofiel Deze organisatie zit in de regio van Den Bosch en is een klein bedrijf. Er werken circa

Bekijk vacature »
Lei Cremers

Lei Cremers

17/10/2015 18:39:50
Quote Anchor link
Hi all,

Ik heb onderstaande JS-code toegepast ten behoeve van een store locator.
De store locator geeft een overzicht van shops op basis van reisafstand vanaf locatie.
Zie hier de link naar de demo-page: http://optimax.apphb.com/demo.html

Mijn vraag heeft betrekking op de foutieve weergave van de afstand.

Als je 'London' invoert in het zoekveld dan wordt bij de eerste hit '11 miles' weergegeven, waar dit 1.1 mile zou moeten zijn.
Bij lange afstanden treedt deze fout ook op. Bij een afstand boven de 1000 miles wordt deze door Google-maps weergeven als bijvoorbeeld 1,161 miles terwijl JS 1.161 mile genereert, alsof de afstand dus minder dan 2 mile zou zijn.

Mogelijk verduidelijkt onderstaande mijn vraag:

Voorbeeld A
Daadwerkelijke afstand: 1,1 mile
Notificatie Google: 1.1 mile
JS genereert foutief: 11 miles

Voorbeeld B
Daadwerkelijke afstand: 1161 miles
Notificatie Google: 1,161 miles
JS genereert foutief: 1.161
Gevolg: deze shop wordt als eerste weergeven (alsof de afstand minder dan 2 mile is) in de resultaten, terwijl deze pas achteraan genoemd zou moeten worden.

Wie zou mij kunnen helpen met de aanpassing in waarschijnlijk JS?
Indien aanvullende informatie nodig is hoor ik het graag.

Thanks!

Hieronder de JS-code:

Code (php)
PHP script in nieuw venster Selecteer het PHP script
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
(function ($) {
    $.fn.storeLocator = function (options) {

        var settings = $.extend({
            'mapDiv': 'map',
            'listDiv': 'list',
            'formID': 'user-location',
            'pinColor': 'fe7569',
            'startPinColor': '66bd4a',
            'pinTextColor': '000000',
            'storeLimit': 10,
            'distanceAlert': 60,
            'xmlLocation': 'data/stores.xml',
            'addressErrorMsg': 'Please enter valid UK address address or postcode',
            'googleDistanceMatrixDestinationLimit': 25,
            'defaultLat': 52.3038165,
            'defaultLng': -1.081117,
            'defaultLocationName': 'Northampton, United Kingdom'
        }, options);

        return this.each(function () {
            var $this = $(this);

            // global array of shop objects
            var _locationset = new Array();
            var geocoder;

            // Calculate distances from passed in origin to all locations in the [_locationset] array
            // using Google Maps Distance Matrix Service https://developers.google.com/maps/documentation/javascript/reference#DistanceMatrixService
            var GeoCodeCalc = {};
            GeoCodeCalc.CalcDistanceGoogle = function (origin, callback) {
                var destCoordArr = new Array();
                var subFunctionTokens = [];

                $.each(_locationset, function (ix, loc) {
                    destCoordArr.push(loc.LatLng);
                });

                for (var i = 0; i < destCoordArr.length; i = i + settings.googleDistanceMatrixDestinationLimit) { // Google Distance Matrix allows up to 25 destinations to be passed in
                    var tempArr = destCoordArr.slice(i, Math.min(i + settings.googleDistanceMatrixDestinationLimit));
                    subFunctionTokens.push(this.CallGoogleDistanceMatrix(i, origin, tempArr));
                }

                $.when.apply($, subFunctionTokens)
                      .then(function () {
                          callback(true);
                      });
            };

            GeoCodeCalc.CallGoogleDistanceMatrix = function (startIndex, origin, destinations) {
                var token = $.Deferred();
                var service = new google.maps.DistanceMatrixService();
                service.getDistanceMatrix(
                  {
                      origins: [origin],
                      destinations: destinations,
                      travelMode: google.maps.TravelMode.DRIVING,
                      unitSystem: google.maps.UnitSystem.METRIC
                  }, function (response, status) {
                      if (response && response.rows.length) {
                          var results = response.rows[0].elements;
                          $.each(results, function (j, val) {
                              if (results[j].status != "ZERO_RESULTS") {
                                  _locationset[startIndex + j].Distance = GoogleMapDistanceTextToNumber(results[j].distance.text);
                              }
                          });

                          token.resolve();
                      }
                  });

                return token.promise();
            };

            // Converts "123.45 mi" into 123.45
            function GoogleMapDistanceTextToNumber(str) {
                return Number(str.replace(/[^0-9.]/g, ""));
            }

            // removes Google Maps URL unfriendly chars from a string
            function formatGoogleMapUrlString(str) {
                return str.replace("&", "%26").replace(" ", "+");
            }

            //Geocode function for the origin location
            geocoder = new google.maps.Geocoder();
            function GoogleGeocode() {
                this.geocode = function (address, callbackFunction) {
                    geocoder.geocode({ 'address': address }, function (results, status) {
                        if (status == google.maps.GeocoderStatus.OK) {
                            var result = {};
                            result.latitude = results[0].geometry.location.lat();
                            result.longitude = results[0].geometry.location.lng();
                            result.formatted_address = results[0].formatted_address;
                            result.address_components = results[0].address_components;
                            callbackFunction(result);
                        } else {
                            handleError("Geocode was not successful for the following reason: " + status);
                            callbackFunction(null);
                        }
                    });
                };

                this.geocodeLatLng = function (LatLng, callbackFunction) {
                    geocoder.geocode({ 'location': LatLng }, function (results, status) {
                        if (status == google.maps.GeocoderStatus.OK && results.length) {
                            callbackFunction(results[0]);
                        } else {
                            handleError("Geocode was not successful for the following reason: " + status);
                            callbackFunction(null);
                        }
                    });
                };
            }

            //Process form input
            $(function () {
                $(document).on('submit', '#' + settings.formID, function (e) {
                    $("#lblError").html("");
                    //Stop the form submission
                    e.preventDefault();
                    //Get the user input and use it
                    var userinput = $('form').serialize();
                    userinput = userinput.replace("address=", "");
                    if (userinput == "") {
                        handleError(settings.addressErrorMsg);
                    }

                    var g = new GoogleGeocode();
                    var address = userinput;
                    g.geocode(address, function (data) {
                        if (data != null) {
                            showAddress(data);
                            mapping(data.latitude, data.longitude);
                        } else {
                            //Unable to geocode
                            handleError(settings.addressErrorMsg);
                        }
                    });

                    //Replace spaces in user input
                    userinput = formatGoogleMapUrlString(userinput);
                });
            });

            $(document).ready(function () {
                // Try HTML5 geolocation
                if (navigator.geolocation) {
                    navigator.geolocation.getCurrentPosition(function (position) {
                        //map.setCenter(pos);
                        var g = new GoogleGeocode();
                        var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);

                        g.geocodeLatLng(latlng, function (address) {
                            if (address) {
                                showAddress(address);
                            } else {
                                //Unable to geocode
                                handleNoGeolocation('Error: Unable to geocode address');
                            }
                        });

                        // do the mapping stuff
                        mapping(position.coords.latitude, position.coords.longitude);

                    }, function () {
                        handleNoGeolocation("Tracking of location was not allowed.");
                    });
                } else {
                    // Browser doesn't support Geolocation
                    handleNoGeolocation(false);
                }
            });

            function showAddress(address) {
                $("#lblAddress").html(address.formatted_address);
                // find a postcode and show it in the address textbox
                $.each(address.address_components, function (i, val) {
                    if (val.types[0] == "postal_code") {
                        $("#address").val(val.short_name);
                        return false; // breaks the each() loop
                    }
                });
            }

            function handleNoGeolocation(error) {
                if (error) {
                    var content = error;
                } else {
                    var content = 'Error: Your browser doesn\'t support geolocation.';
                }

                handleError(content + " Using default location.");
                mapping(settings.defaultLat, settings.defaultLng);
                $("#lblAddress").html(settings.defaultLocationName);

            }

            function handleError(error) {
                $("#lblError").html(error);
            }

            //Now all the mapping stuff
            function mapping(orig_lat, orig_lng) {
                $(function () {
                    //Parse xml with jQuery
                    $.ajax({
                        type: "GET",
                        url: settings.xmlLocation,
                        dataType: "xml",
                        success: function (xml) {
                            _locationset = new Array();
                            $(xml).find('Placemark').each(function (i) {
                                var shop = {
                                    Name: $(this).find('name').text(),
                                    //Take the lat lng from the user, geocoded above
                                    LatLng: new google.maps.LatLng(
                                        $(this).find('coordinates').text().split(",")[1],
                                        $(this).find('coordinates').text().split(",")[0]),
                                    Description: $(this).find('description').text(),
                                    Marker: null,
                                    Distance: null
                                };
                                _locationset.push(shop);
                            });

                            // Calc Distances from user's location
                            GeoCodeCalc.CalcDistanceGoogle(new google.maps.LatLng(orig_lat, orig_lng), function (success) {
                                if (!success) { //something went wrong
                                    handleError("Unable to calculate distances at this time");
                                }
                                else {
                                    //Sort the multi-dimensional array numerically
                                    _locationset.sort(function (a, b) {
                                        return ((a.Distance < b.Distance) ? -1 : ((a.Distance > b.Distance) ? 1 : 0));
                                    });

                                    // take "N" closest shops
                                    _locationset = _locationset.slice(0, settings.storeLimit);

                                    //Check the closest marker
                                    if (_locationset[0].Distance > settings.distanceAlert) {
                                        handleError("Unfortunately, our closest location is more than " + settings.distanceAlert + " miles away.");
                                    }

                                    //Create the map with jQuery
                                    $(function () {
                                        var orig_LatLng = new google.maps.LatLng(orig_lat, orig_lng);
                                        //Google maps settings
                                        var myOptions = {
                                            center: orig_LatLng,
                                            mapTypeId: google.maps.MapTypeId.ROADMAP
                                        };

                                        var map = new google.maps.Map(document.getElementById(settings.mapDiv), myOptions);
                                        //Create one infowindow to fill later
                                        var infowindow = new google.maps.InfoWindow();

                                        //Add user location marker
                                        var marker = createMarker(orig_LatLng, "0", settings.startPinColor);
                                        marker.setAnimation(google.maps.Animation.DROP);
                                        var bounds = new google.maps.LatLngBounds();
                                        bounds.extend(orig_LatLng);

                                        $("#" + settings.listDiv).empty();

                                        $(_locationset).each(function (i, location) {
                                            bounds.extend(location.LatLng);
                                            letter = String.fromCharCode("A".charCodeAt(0) + i);
                                            location.Marker = createMarker(location.LatLng, letter, settings.pinColor);
                                            create_infowindow(location);
                                            listClick(letter, location);
                                        });

                                        // zoom in/out to show all markers
                                        map.fitBounds(bounds);

                                        function listClick(letter, shop) {
                                            $('<li />').html("<div class=\"list-details\"><div class=\"list-content\">"
                                            + "<div class=\"list-label\">" + letter + "<\/div>"
                                            + "<div class=\"loc-name\">" + shop.Name + "<\/div> <div class=\"loc-addr\">" + shop.Description + "<\/div>"
                                            + (shop.Distance ? "<div class=\"loc-addr2\"><i>approx. " + shop.Distance + " miles</i><\/div>" : "")
                                            + "<div class=\"loc-web\"><a href=\"http://maps.google.co.uk/maps?saddr="
                                            + formatGoogleMapUrlString($("#address").val()) + "+%40" + orig_lat + "," + orig_lng
                                            + "&daddr=" + formatGoogleMapUrlString(shop.Name) + "+%40" + shop.LatLng.lat() + "," + shop.LatLng.lng()
                                            + "&hl=en" + "\" target=\"_blank\">&gt;Get directions</a><\/div><\/div><\/div>")
                                            .click(function () {
                                                create_infowindow(shop, "left");
                                            }).appendTo("#" + settings.listDiv);
                                        };

                                        //Custom marker function - aplhabetical
                                        function createMarker(point, letter, pinColor) {
                                            //Set up pin icon with the Google Charts API for all of our markers
                                            var pinImage = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld=" + letter + "|" + pinColor + "|" + settings.pinTextColor,
                                              new google.maps.Size(21, 34),
                                              new google.maps.Point(0, 0),
                                              new google.maps.Point(10, 34));
                                            var pinShadow = new google.maps.MarkerImage("http://chart.apis.google.com/chart?chst=d_map_pin_shadow",
                                              new google.maps.Size(40, 37),
                                              new google.maps.Point(0, 0),
                                              new google.maps.Point(12, 35));

                                            //Create the markers
                                            return new google.maps.Marker({
                                                position: point,
                                                map: map,
                                                icon: pinImage,
                                                shadow: pinShadow,
                                                draggable: false
                                            });
                                        };

                                        //Infowindows
                                        function create_infowindow(shop, listLocation) {
                                            var formattedAddress = "<div class=\"infoWindow\"><b>" + shop.Name + "<\/b>"
                                            + "<div>" + shop.Description + "<\/div>"
                                            + (shop.Distance ? "<div><i>" + shop.Distance + " miles<\/i><\/div><\/div>" : "<\/div>");

                                            //Opens the infowindow when list item is clicked
                                            if (listLocation == "left") {
                                                infowindow.setContent(formattedAddress);
                                                infowindow.open(shop.Marker.get(settings.mapDiv), shop.Marker);
                                            }
                                            //Opens the infowindow when the marker is clicked
                                            else {
                                                google.maps.event.addListener(shop.Marker, 'click', function () {
                                                    infowindow.setContent(formattedAddress);
                                                    infowindow.open(shop.Marker.get(settings.mapDiv), shop.Marker);
                                                })
                                            }
                                        };
                                    });
                                }
                            });
                        }
                    });
                });
            }

        });
    };
})(jQuery);
[/CODE]
 
Er zijn nog geen reacties op dit bericht.



Overzicht Reageren

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.