Mapbox-gl-js: Add a "popup.close" event

Created on 18 May 2016  路  10Comments  路  Source: mapbox/mapbox-gl-js

Popups should emit an event when they are closed.

feature good first issue

Most helpful comment

@nibygro try listen to it this way:

let popup = new mapboxgl.Popup()
popup.on('close', function(e) {
    alert()
})

All 10 comments

This is complete!

Hi @mapsam . How can I listen to it?

    map.on('popup.close', function(e) {
        alert();
    });

doesn't work

@nibygro try listen to it this way:

let popup = new mapboxgl.Popup()
popup.on('close', function(e) {
    alert()
})

@Luqqk it works, thanx!

Thanks @Luqqk!

It is working but pupup close event fire twice when open and close.

I am seeing the same as @ansarikhurshid786; the popup close event fires for a new popup when it is created, if I removed an existing popup before creating the new popup

I am also seeing popup.on('close', ...) fire on creation, and then twice on close.

@nibygro try listen to it this way:

let popup = new mapboxgl.Popup()
popup.on('close', function(e) {
    alert()
})

not working for me

Same thing, this event fires in wrong time ((((

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muesliq picture muesliq  路  3Comments

PBrockmann picture PBrockmann  路  3Comments

shotor picture shotor  路  3Comments

rasagy picture rasagy  路  3Comments

aendrew picture aendrew  路  3Comments