S
S
Sergey Khlopov2019-05-25 14:27:11
Yandex maps
Sergey Khlopov, 2019-05-25 14:27:11

How can I prevent the filter from being applied to objects on the map?

I apply a css filter to the map, more precisely to the div in which this map is located:

-webkit-filter: grayscale(50%);
    -moz-filter: grayscale(50%);
    -o-filter: grayscale(50%);
    filter: grayscale(50%);

And when I add a polygon to the map, it also falls under this filter, but it is necessary that the filter is not applied to objects on the map. How can such a problem be solved? Map screen:

5ce926ab9a792779462091.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-05-25
@Shlop

.gray {
  -webkit-filter: grayscale(100%);
  -moz-filter: grayscale(100%);
  -o-filter: grayscale(100%);
  filter: grayscale(100%);
}

map.panes.get('ground').getElement().classList.add('gray');

https://jsfiddle.net/8y0t6kjv/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question