Google Map Instant Search In Jquery
Just like the last article" Wikipedia Instant Search In Jquery "and now i created a new looking "Google Map Instant Search" with simple jquery and j-son script ,by using Google's API and by using instant search function keyup(function(e)) this will started to display the places as you type the results on the search box with simple and neat user interface and easy to search .
Screen Shot Below :
$(function() {
$("#address").autocomplete({
minLength: 1,
source: function(request, response) {
if(request.term.length >= 3)
_gaq.push(['_trackEvent','Google Maps', 'Search Terms', request.term]);
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
}
}));
})
},
//This bit is executed upon selection of an address
select: function(event, ui) {
$("#latitude").val(ui.item.latitude);
$("#longitude").val(ui.item.longitude);
var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
marker.setPosition(location);
map.setCenter(location);
},
close: function() {
}
});
});
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(37.7749295, -122.4194155);
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
marker = new google.maps.Marker({
map: map,
draggable: true
});
}
function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
}
});
}
You May Also Like This : Wikipedia Instant Search In Jquery
If you like this post about "Google map instant search in jquery", please do comment, share,tweet and like it thank you..
Note these words listed below is for incoming search to increase keyword density so please dont mind of it thank you.
Google map instant search with jquery,Google map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jquery
Screen Shot Below :
Script Functions
$("#address").autocomplete({
minLength: 1,
source: function(request, response) {
if(request.term.length >= 3)
_gaq.push(['_trackEvent','Google Maps', 'Search Terms', request.term]);
geocoder.geocode( {'address': request.term }, function(results, status) {
response($.map(results, function(item) {
return {
label: item.formatted_address,
value: item.formatted_address,
latitude: item.geometry.location.lat(),
longitude: item.geometry.location.lng()
}
}));
})
},
//This bit is executed upon selection of an address
select: function(event, ui) {
$("#latitude").val(ui.item.latitude);
$("#longitude").val(ui.item.longitude);
var location = new google.maps.LatLng(ui.item.latitude, ui.item.longitude);
marker.setPosition(location);
map.setCenter(location);
},
close: function() {
}
});
});
function initialize() {
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(37.7749295, -122.4194155);
var myOptions = {
zoom: 15,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
marker = new google.maps.Marker({
map: map,
draggable: true
});
}
function codeAddress() {
var address = document.getElementById("address").value;
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
}
});
}
You May Also Like This : Wikipedia Instant Search In Jquery
If you like this post about "Google map instant search in jquery", please do comment, share,tweet and like it thank you..
Author : Solomon David
Note these words listed below is for incoming search to increase keyword density so please dont mind of it thank you.
Google map instant search with jquery,Google map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jqueryGoogle map instant search with jquery
really cool script man !!!
ReplyDeletekool
ReplyDelete