File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,11 @@ const onMapReady = async () => {
79
79
markers: locations
80
80
});
81
81
// Access the markers
82
- markers [3 ].bindPopup (' Hello Pornic' );
82
+ markers [3 ].bindPopup (' <h1>Hello Pornic</h1><button type="button" style="background: black; color: white;">Click me</button>' );
83
+ const popupDiv = markers [2 ].getPopup ()?.getContent () as HTMLElement ;
84
+ popupDiv .addEventListener (' click' , () => {
85
+ console .log (" click" )
86
+ });
83
87
// Access the markerCluster
84
88
markerCluster .on (' clusterclick' , (event : any ) => {
85
89
console .log (' Cluster clicked' , event );
Original file line number Diff line number Diff line change @@ -40,7 +40,9 @@ export const useLMarkerCluster = async (props: Props) => {
40
40
41
41
// If a popup is provided, bind it to the marker
42
42
if ( location . popup ) {
43
- marker . bindPopup ( L . popup ( ) . setContent ( location . popup ) )
43
+ const popup = L . DomUtil . create ( 'div' , 'popup' )
44
+ popup . innerHTML = location . popup
45
+ marker . bindPopup ( popup )
44
46
}
45
47
46
48
// Add the marker to the cluster
You can’t perform that action at this time.
0 commit comments