css 如何变色YandexMap,但离开地理着色?

3pvhb19x  于 2023-03-09  发布在  其他
关注(0)|答案(1)|浏览(209)

下面引用了示例代码,试试Yandex的老Map,选择这个选项按钮:.ymaps-layers-pane-工作,但没有2.1。这是可取的,使它跨浏览器,在IE中不工作

div#map {
  filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
  /* Firefox 3.5+ */
  -webkit-filter: grayscale(100%);
  /* Chrome 19+ & Safari 6+ */
  filter: grayscale(100%);
  -webkit-filter: grayscale(100%);
  -moz-filter: grayscale(100%);
  -ms-filter: grayscale(100%);
  -o-filter: grayscale(100%);
  filter: url(desaturate.svg#greyscale);
  filter: gray;
}
<script src="http://a159152.mcdir.ru//sites/all/themes/COSMO/2.1.js"></script>
<div id="map" style="width: 100%; height: 700px"></div>
<script type="text/javascript">
  ymaps.ready(init);
  var myMap;

  function init() {
    myMap = new ymaps.Map("map", {
      center: [51.767481084662506, 55.113224784597655],
      zoom: 16
    });

    var myPlacemark = new ymaps.Placemark([51.767481084662506, 55.113224784597655], {}, {
      iconLayout: 'default#image',
      iconImageHref: 'http://a159152.mcdir.ru//sites/all/themes/COSMO/images/icon_location_2.png',
      iconImageSize: [158, 176],
      iconImageOffset: [-69, -277]
    });
    myMap.geoObjects.add(myPlacemark);
  }
</script>
ggazkfy8

ggazkfy81#

我不知道它是否仍然为你实际)但我有同样的问题,并找到答案:

[class*="ymaps-"][class*="-ground-pane"] {
    filter: grayscale(100);
  }

这里是a link

相关问题