Salve,
utilizzo un plugin di jquery per visualizzare una mappa in base ad un indirizzo.
Attraverso un autocomplete mi trova l'indirizzo e poi automaticamente mi centra la mappa sullo stesso.
Io vorrei (visto che poi dovrei utilizzarlo con un calendario eventi) poter visualizzare la mappa solo mediante un click su un pulsanti.
Il mio problema è che non riesco a trovare il punto esatto per inserire l'evento .click di jquery. Grazie Daniele
codice:
<script type="text/javascript">
$(function(){
$('#test').gmap3({
action: 'init',
options:{
center:[45.6507624, 9.3791030],
zoom:15,
mapTypeId: google.maps.MapTypeId.SATELLITE,
mapTypeControl: true,
mapTypeControlOptions:
{
style: google.maps.MapTypeControlStyle.DROPDOWN_MENU
},
navigationControl: true,
scrollwheel: true,
streetViewControl: true
}
});
$('#address').autocomplete({
source: function() {
$("#test").gmap3({
action:'getAddress',
address: $(this).val(),
callback:function(results){
if (!results) return;
$('#address').autocomplete(
'display',
results,
false
);
},
});
},
cb:{
cast: function(item){
return item.formatted_address;
},
select: function(item) {
$("#test").gmap3(
{action:'clear', name:'marker'},
{action:'addMarker',
latLng:item.geometry.location,
map:{center:true,zoom:25},
marker:{
options:{
draggable: false
}
},
infowindow:{
options:{
content: $('#titolo').val()
}
}
}
);
}
}
})
.focus();
});
</script>
...
<input type='text' id='titolo'>
<input type="text" id="address" size="60">
<div id="test" class="gmap3"></div>