[英]Weird Zoom Button style in Google Map. Anyone has any ideas?
I'm using google map JS api on the map. 我在地图上使用google map JS api。 And the this is a wordpress website.
而这是一个wordpress网站。 I'm adding a google map to the contact page template.
我正在将Google地图添加到联系页面模板。 But, there are some really weird things.
但是,有一些非常奇怪的事情。 The Zoom In and Zoom Out button style is not + and -.
放大和缩小按钮样式不是+和-。 Anyone has any ideas?
有人有什么想法吗? How can I have the default + - button?
如何获得默认的+-按钮? JS fiddle for the Google Map Codes:
JS拨弄Google Map Codes:
var map; function initialize() { var mapOptions = { mapTypeId: google.maps.MapTypeId.ROADMAP, mapTypeControl: false, zoom: <?php echo $map_zoom;?>, zoomControl: true, scrollwheel: false, zoomControlOptions: { style: google.maps.ZoomControlStyle.DEFAULT, position: google.maps.ControlPosition.DEFAULT }, panControl: false, streetViewControl: false, scaleControl: false, overviewMapControl: false, center: new google.maps.LatLng(<?php echo $contact_info['map']['lat'];?>,<?php echo $contact_info['map']['lng'];?>) }; map = new google.maps.Map(document.getElementById('map-canvas'), mapOptions); var infoContent = '<div class="window-content"><h4><?php echo bloginfo('name');?></h4><div class="contact-address" itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"><?php if(isset($contact_info['address_1']) ):?><span itemprop="streetAddress"><?php echo $contact_info['address_1'];?><?php if(isset($contact_info['address_2']) ):?>,<br/><?php echo $contact_info['address_2']; ?> <?php endif;?></span><br/><?php endif;?><?php if(isset($contact_info['city']) ):?><span itemprop="addressLocality"><?php echo $contact_info['city'];?></span> <?php endif;?><?php if(isset($contact_info['postcode']) ):?><span itemprop="postalCode"><?php echo $contact_info['postcode'];?></span> <?php endif;?><?php if(isset($contact_info['state']) ):?><span itemprop="addressRegion"><?php echo $contact_info['state'];?></span><?php endif;?><?php if(isset($contact_info['country']) ):?><br/><span itemprop="addressCountry"><?php echo $contact_info['country'];?></span><?php endif;?></div></div>'; var infowindow = new google.maps.InfoWindow({ content: infoContent }); var icon = { path: 'M16.5,51s-16.5-25.119-16.5-34.327c0-9.2082,7.3873-16.673,16.5-16.673,9.113,0,16.5,7.4648,16.5,16.673,0,9.208-16.5,34.327-16.5,34.327zm0-27.462c3.7523,0,6.7941-3.0737,6.7941-6.8654,0-3.7916-3.0418-6.8654-6.7941-6.8654s-6.7941,3.0737-6.7941,6.8654c0,3.7916,3.0418,6.8654,6.7941,6.8654z', anchor: new google.maps.Point(16.5, 51), fillColor: '<?php echo $map_marker_colour;?>', fillOpacity: 0.6, strokeWeight: 0, scale: 1 }; var marker = new google.maps.Marker({ position: new google.maps.LatLng(<?php echo $contact_info['map']['lat'];?>,<?php echo $contact_info['map']['lng'];?>), map: map, icon: icon, title: 'marker' }); google.maps.event.addListener(marker, 'click', function() { infowindow.open(map,marker); }); } google.maps.event.addDomListener(window, 'load', initialize);
Just to make sure when you do your own style, do not let any img style overwrite the google map img style. 只是为了确保当您使用自己的样式时,请勿让任何img样式覆盖Google map img样式。 By default it is
.gm-style img{ max-width: none; }
默认情况下,它是
.gm-style img{ max-width: none; }
.gm-style img{ max-width: none; }
If you have to use !important on some img tag, Then use: .gm-style img{ max-width: none !important; }
.gm-style img{ max-width: none; }
如果必须在某些img标签上使用!important,请使用: .gm-style img{ max-width: none !important; }
.gm-style img{ max-width: none !important; }
to fix. .gm-style img{ max-width: none !important; }
修复。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.