javascript - Having two different leaflet popup styles simultaneously -


i wondering if possible have 2 different styles of popup. here example: solid transparent want use both of styles independently of each other. example have solid background rectangle , transparent marker. code changes transparent:

.leaflet-popup-content-wrapper {     background: #d3d3d3;     background: transparent; } 

thank information can provide noob :)

edit: tried go way @n0m4d suggested adding class popup, did not seem anything:

js:

var popup = l.popup({classname: 'pareina'})     .setlatlng([0, 0])     .setcontent("i standalone popup.")     .openon(map); 

css:

.pareina{     background: black; } 

edit2: managed work, here did:

js:

var popup = l.popup({classname: 'pareina'})     .setlatlng([0, 0])     .setcontent("i standalone popup.")     .openon(map); 

css did things bit differently:

.pareina .leaflet-popup-content-wrapper{     background: transparent; } 

basically made .leaflet-popup-content-wrapper child element of .pareina , worked! :) thank helping @n0m4d

according leaflet's js docs, can pass in class name popup options:

classname option: custom class name assign popup.

so code this:

var popup = l.popup({classname: 'leaflet-popup-content-wrapper' })              .setlatlng(latlng)              .setcontent('<p>hello world!<br />this nice popup.</p>')              .openon(map); 

Comments