Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Leaflet popup width

Im trying to get a video inside a leaflet popup. The problem is that the width of the video is set on 560 and the default maxwidth of a popup is 300.

I found that there is an option maxWidth and minWidth in leaflet, but can't seem to get it working.

Below is the code that currently works, but is missing the width options;

goodVoteLayer.bindPopup('<object data="http://www.youtube.com/embed/W7qWa52k-nE" width="560" height="315"></object>');

This is a link to the leaflet docs on popups. http://leafletjs.com/reference-1.0.0.html#popup-option

Thank you in advance.

like image 204
Kenneth Breugelmans Avatar asked Jun 24 '16 07:06

Kenneth Breugelmans


1 Answers

The second argument to bindPopup is the same options that you would give to L.popup, so you should be able to add max/minWidth like so:

goodVoteLayer.bindPopup('<object data="http://www.youtube.com/embed/W7qWa52k-nE" width="560" height="315"></object>', {
    maxWidth : 560
});
like image 116
bozdoz Avatar answered Nov 20 '22 18:11

bozdoz