javascript - Why the popup is not showing second time in leaflet marker -


i drawing marker in leaflet map , on clicking marker showing popup message.

if click marker first time see popup message. if close popup message , again click marker don't see popup message though code enters inside on click event code block console message printed.

here code of click event

circle.on("click",function(ev){     var velocity=this.options.speed;     console.log(velocity.tofixed(2));     var layer=ev.target;     layer.bindpopup('speed: '+velocity.tofixed(2));     console.log("where pop");     layer.openpopup(); }); 

currently, you're creating popup each time when user click marker. probably, creating problem.

you need use bindpopup() function once i.e when create marker. , use openpopup() inside click function. try this

//place below 2 lines create marker var velocity=this.options.speed; //you might need change line speed value circle.bindpopup('speed: '+velocity.tofixed(2));  //open popup when user click marker circle.on("click",function(ev){     layer.openpopup(); }); 

Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -