mercredi 17 juillet 2019

How to load images based on what marker is clicked on my map

I want to load a selection of images of a certain location when that marker is clicked on my leaflet map. For each marker the number of images will vary.

I currently have my leaflet map with test markers which show the same hidden div when clicked.

This is the code for my markers onclick and onhover events

var London = L.marker([51.5, -0.09], {icon: CamIcon}).addTo(mymap);
    London.on('click', function(){
       document.getElementById("frame2").style.display="inline- 
block";


    });
    London.on('mouseover', function() {

    });

var India = L.marker([20.5937, 78.9629], {icon: 
CamIcon}).addTo(mymap);
    India.on('click', function(){
        document.getElementById("frame2").style.display="inline- 
block";

    });
    India.on('mouseover', function() {

    });

 });

Aucun commentaire:

Enregistrer un commentaire