传单标记的弹出窗口会淡入淡出

时间:2018-08-20 09:21:53

标签: javascript angular leaflet

我一直在使用带有角度的地图Web应用程序,其中有几个标记,我想使弹出窗口自行淡入和淡出(使用计时器),但是我不知道如何:

我用来在弹出窗口中做标记的代码是

  L.marker([50.627141, 3.203248], {icon: newico}).bindPopup('<h4>Swing dancing 17:30</h4><p>Place des fleurs</p>').addTo(myfrugalmap).openPopup();

谢谢

1 个答案:

答案 0 :(得分:2)

L.marker([LatLng], {
  icon: L.icon({
    iconUrl: 'YourIcon',
    className: 'blink'
  })
}).addTo(myfrugalmap);
L.DomUtil.addClass(marker._icon, "blink");

CSS:

#map {
  bottom: 0;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

@keyframes fade { 
  from { opacity: 0.8; } 
}

.blink {
  animation: fade 1s infinite alternate;
}
相关问题