Skip to main content
deleted 25 characters in body
Source Link
PolyGeo
  • 65.4k
  • 29
  • 114
  • 345

Is there a way to set the background image of a leaflet pop up dynamically? 

I have multiple markers with popups, which all need a different background image. The filepaths for the images are being pulled from a database.

I have tried using jQuery to change the background property of the ".custom-popup .leaflet-popup-content-wrapper" classes, but the change does not occur. When I type $(".leaflet-popup-content-wrapper") into the console, it returns an empty array which tells me that the current page cannot even see this class.

Any ideas on howHow can I could dynamically apply a background image to each of the popups?

Thanks!

Is there a way to set the background image of a leaflet pop up dynamically? I have multiple markers with popups, which all need a different background image. The filepaths for the images are being pulled from a database.

I have tried using jQuery to change the background property of the ".custom-popup .leaflet-popup-content-wrapper" classes, but the change does not occur. When I type $(".leaflet-popup-content-wrapper") into the console, it returns an empty array which tells me that the current page cannot even see this class.

Any ideas on how I could dynamically apply a background image to each of the popups?

Thanks!

Is there a way to set the background image of a leaflet pop up dynamically? 

I have multiple markers with popups, which all need a different background image. The filepaths for the images are being pulled from a database.

I have tried using jQuery to change the background property of the ".custom-popup .leaflet-popup-content-wrapper" classes, but the change does not occur. When I type $(".leaflet-popup-content-wrapper") into the console, it returns an empty array which tells me that the current page cannot even see this class.

How can I dynamically apply a background image to each of the popups?

Source Link

Dynamically Change Leaflet PopUp Background

Is there a way to set the background image of a leaflet pop up dynamically? I have multiple markers with popups, which all need a different background image. The filepaths for the images are being pulled from a database.

I have tried using jQuery to change the background property of the ".custom-popup .leaflet-popup-content-wrapper" classes, but the change does not occur. When I type $(".leaflet-popup-content-wrapper") into the console, it returns an empty array which tells me that the current page cannot even see this class.

Any ideas on how I could dynamically apply a background image to each of the popups?

Thanks!