我已使用此方法向我的站点添加了一个地址自动完成字段:
http://ubilabs.github.io/geocomplete/examples/simple.html
使用的确切代码(取自上面的站点)是这样的:
<!--GeoLocation AutoComplete--->
<script src="http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://ubilabs.github.io/geocomplete/jquery.geocomplete.js"></script>
<script>
$(function(){
$("#geocomplete1").geocomplete()
.bind("geocode:result");
});
</script>
<!--HTML-->
<label class="inp2"><input id="geocomplete1" onfocus="this.value=''" onblur ="if (this.value == '') { this.value ='Enter Address from' }" value="Enter Address from" type="text"></label>
这可以正常工作并自动完成地址,但由于某些奇怪的原因,应该位于建议框右下角的“由谷歌提供支持” Logo 没有显示。
澄清一下,我说的不是搜索字段右侧的“powered by google” Logo ,我说的是地址建议框中的那个,它会在您开始输入时打开。
最佳答案
谢谢 ilmk,虽然直接将那行添加到我的 CSS 并没有达到我想要的效果,它只是在我的建议框右侧添加了 Logo ,这是我不需要的,但是你确实给了我一个想法到哪里添加解决问题的行,
添加后:
background: url(https://developers.google.com/maps/documentation/places/images/powered-by-google-on-white.png) no-repeat center right;
我的 .pac-container
在我的 style.css 中,像这样:
.pac-container:after{
content:"";
padding:1px 1px 1px 0;
height:16px;
text-align:right;
display:block;
background: url(https://developers.google.com/maps/documentation/places/images/powered-by-google-on-white.png) no-repeat center right;
}
一切正常!再次感谢。
关于javascript - 由 Google 提供支持的 Logo 未显示在地址自动完成字段中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23466697/