如何更改Google Maps公交站点的默认图标? [英] How to change Google Maps bus stops default icon?

查看:144
本文介绍了如何更改Google Maps公交站点的默认图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何用javascript更改此巴士图标?很容易更改标记和路线颜色等,但如何更改此图标显示在下面的图片上?

解决方案

是不是基于API的方式来更改这些图标。



一个选项将使用CSS,例如使用您的头像而不是图标:

  / *这将隐藏总线图标* / 
img [src =https://maps.gstatic.com/mapfiles/transit /iw2/6/bus.png] {
width:0!important;
}

/ *使用自定义图标作为图标后面的跨度背景* /
img [src =https://maps.gstatic.com/mapfiles /transit/iw2/6/bus.png] + span {
background:url(http://i.stack.imgur.com/8lcVw.png?s=32&g=1)no-repeat ;
background-size:16px 16px;
padding-left:18px;
}

但这只是一个解决方法,只有在标记为这些工具提示或图标的src不会被更改。


How to change this bus icon with javascript? It's easy to change markers and and route color and so on, but how to change this icon what is shown on a picture below?

解决方案

There is no API-based way to change these icons.

An option would be to use CSS, example using your avatar instead of the icon:

  /*this will hide the bus-icon*/
  img[src="https://maps.gstatic.com/mapfiles/transit/iw2/6/bus.png"]{
    width:0 !important;
  }

  /*use a custom icon as background for the span which follows the icon*/
  img[src="https://maps.gstatic.com/mapfiles/transit/iw2/6/bus.png"]+span{
    background:url(http://i.stack.imgur.com/8lcVw.png?s=32&g=1) no-repeat;
    background-size: 16px 16px;
    padding-left:18px;
  }

But it's only a workaround, it will only work as long as the markup for these tooltips or the src of the icon will not be changed.

这篇关于如何更改Google Maps公交站点的默认图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆