Last active
February 4, 2018 04:22
-
-
Save godie007/f8581cc65f88943269246865e8145025 to your computer and use it in GitHub Desktop.
Codigo Ejemplo Google Maps
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script src="/vendor/jquery/jquery.js"></script> | |
| <script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDaqJrcvUyHQlDrV6gASSUr3Fi39NRSJLg&v=3.exp&libraries=places"></script> | |
| <script src="/views/establecimiento/index.min.js?undefined"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| setTimeout(function() { | |
| $('.gridtable').DataTable({}); | |
| $("tr").click(function(index) { | |
| google.maps.event.trigger(marker[$(this).find("td").eq(0).text()], 'click'); | |
| }) | |
| var locations = JSON.parse($("#valor").attr("class")); | |
| var map = new google.maps.Map(document.getElementById('map'), { | |
| zoom: 16, | |
| center: new google.maps.LatLng(4.5514281, -75.6602994), | |
| mapTypeId: google.maps.MapTypeId.ROADMAP | |
| }); | |
| var myCity = new google.maps.Circle({ | |
| center: new google.maps.LatLng(4.5514281, -75.6602994), | |
| radius: 500, | |
| strokeColor: "#0000FF", | |
| strokeOpacity: 0.8, | |
| strokeWeight: 2, | |
| fillColor: "#0000FF", | |
| fillOpacity: 0.4 | |
| }); | |
| myCity.setMap(map); | |
| var infowindow = new google.maps.InfoWindow(); | |
| for (i = 0; i < locations.length; i++) { | |
| var image = ''; | |
| if (locations[i][4] !== null) { | |
| image = locations[i][4].split('<img src=')[1].split('>')[0]; | |
| } | |
| marker[i] = new google.maps.Marker({ | |
| position: new google.maps.LatLng(locations[i][1], locations[i][2]), | |
| label: i + '', | |
| animation: google.maps.Animation.DROP, | |
| icon: image, | |
| map: map | |
| }); | |
| google.maps.event.addListener(marker[i], 'click', (function(marker, i) { | |
| return function() { | |
| var imagen = locations[i][4]; | |
| var titulo = "<Label>" + locations[i][0] + "</label>"; | |
| var textarea = "<textarea id='comentario' class='form-control'></textarea>"; | |
| var boton = "<button type='submit' id='ing_msj' class='btn btn-large btn-primary form-control'>Comentar</button>"; | |
| map.setCenter(marker.getPosition()); | |
| infowindow.setContent("<div class='control-group'>" + imagen + titulo + "<br>" + textarea + "<br>" + boton + "</div>"); | |
| infowindow.open(map, marker); | |
| $("#comentario").prop("placeholder", locations[i][5]); | |
| $("#ing_msj").click(function() { | |
| var a = locations[i][6]; | |
| var b = $("#comentario").val(); | |
| ingresarComentario(a, b); | |
| }); | |
| } | |
| })(marker[i], i)); | |
| } | |
| }, 1000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment