Reputation: 3424
How I can reproduce this plugin in jsfiddle ? Code so far is here. My problem is- I can see response data is coming for each request using firebug, but the autocomplete list is not showing up. Thanks for your time guys.
Adding the code directly from fiddle - HTML :
<!-- required js libraries -->
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> <!-- jQuery is directly loaded from fiddle, so in the live example I skipped this line -->
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="http://gmap3.net/js/gmap3-4.1-min.js"></script>
<script type="text/javascript" src="https://raw.github.com/jbdemonte/autocomplete/master/jquery-autocomplete.min.js"></script>
<!-- this is required to help autocomplete plugin -->
<link rel="stylesheet" type="text/css" href="https://raw.github.com/jbdemonte/autocomplete/master/jquery-autocomplete.css" />
<input type="text" id="address" size="60"/>
<div id="test" style="height:350px; width:600px"></div>
And here is the javascript :
/*This one initializes the map*/
$("#test").gmap3();
/*This is the autocomplete code*/
$('#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}
}
);
}
}
});
Upvotes: 0
Views: 2393
Reputation: 171690
Can make your version work by wrapping the input in a container and adding some margin between that container and map. I don't think the css is being delivered properly from github resource as I also had to add some extra z-index to get the results list to show over top of map
Working demo: http://jsfiddle.net/VBFxp/3/
Upvotes: 2