I have a lot of information that I want to show on a Leaflet Popup. For these type of markers (I have four different layers and each marker show different information) I have three elements:
- General description
- Images
- Video
But I want to show them as tabs inside the Popup. Something like these:
To add each icon I use these method:
L.marker([20.683, -88.568], {icon: tiloIcon}).bindPopup('<p><strong><center> Chichén Itzá</center></strong><br><strong>Cultura</strong><br />Maya <br/> <strong>Descripción</strong><br />Es uno de los sitios arqueológicos más importantes de la Península de Yucatán. Es la ciudad más impresionante del periodo Clásico maya y fue inscrita en la lista del Patrimonio de la Humanidad de la UNESCO.<br /><a href="http://superexample.com" target="_blank">Ver ficha completa</a></p> <img src="emoji.png" style="width:200px;"> <iframe width="300" height="200" src="https://www.youtube.com/embed/kd8fBAaKU90" frameborder="0" allowfullscreen></iframe>').addTo(sitios),
Additionally, I want that the title tab disappear and show it at the top of the popup
Do you know any way to put the information on tabs?
Best Answer
Before you create your markers, create a variable that will hold your popup tabs content, e.g.:
Then bind that content to your marker
bindPopup(content)
:Working example on codepen: http://codepen.io/dagmara223/pen/LxwYrY (example is with polygons, but binding popup method works the same)