G
G
gotohell2017-07-12 06:49:46
JavaScript
gotohell, 2017-07-12 06:49:46

Reverse hover on Yandex placemark map?

There is a Yandex map where I display a label, when the label is hovered, the map becomes transparent (everything works fine). I would like to make a reverse hover so that when you move the mouse away from the label, the map becomes visible.

ymaps.ready(init);
function init(){
    var myMapEkv;
    myMapekv = new ymaps.Map("maps", {
        center: [51.14195157262615,71.42617099999994],
        zoom: 17,
        controls: [],
    });
    myMapekv.behaviors.disable('scrollZoom');
    myMapekv.controls.add("zoomControl", {
        position: {top: 0, left: 0}
    });
    var myPlacemarkEkv = new ymaps.Placemark([51.1421742908667,71.42616027116388], {},
        { iconLayout: 'default#image',
          iconImageHref: 'http://pucha.kz/wp-content/themes/pucha/images/metka.png',
          iconImageSize: [35, 66],
         });
     myMapekv.geoObjects.add(myPlacemarkEkv);
     myPlacemarkEkv.events.add('hover', function () {
     $('#maps').fadeTo(500, 0.5);
      },
      function(){
        $('#maps').fadeTo(500, 1);
      }
    );
    }

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
gotohell, 2017-07-12
@gotohell

Maybe someone will come in handy!

ymaps.ready(init);
function init(){
    var myMapEkv;
    myMapekv = new ymaps.Map("maps", {
        center: [51.141344153752435,71.42610662698357],
        zoom: 17,
        controls: [],
    });
    myMapekv.behaviors.disable('scrollZoom');
    myMapekv.controls.add("zoomControl", {
        position: {top: 0, left: 0}
    });
    var myPlacemarkEkv = new ymaps.Placemark([51.1421742908667,71.42614954232782], {},
        { iconLayout: 'default#image',
          iconImageHref: 'http://pucha.kz/wp-content/themes/pucha/images/metka.png',
          iconImageSize: [35, 66],
         });
   myMapekv.geoObjects.add(myPlacemarkEkv);
   myPlacemarkEkv.events.add('hover', function () {
     $('#maps').fadeTo(500, 0.4);
      });
   myMapekv.events.add('mouseenter', function () {
       $('#maps').fadeTo(500, 1);
  });
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question