如何使其跨浏览器?下面引用了示例代码,尝试使用旧地图Yandex,选择此选项按钮:.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>
我不确定它是否仍然适合您)但我有同样的问题并找到了答案:
[class*="ymaps-"][class*="-ground-pane"] {
filter: grayscale(100);
}
这是一个链接