Closed adam-jones-net closed 4 years ago
I've resolved. I realised that the promoPopup.close(); isn't needed in the scenario when the popup closes itself so I was trying to call a close() on a popup instance that no longer existed.
Still I'd recommend maybe that the code is hardened to stop an error on this mistake if the instance can't be found.
I have just used the onClose event for the first time and I have an issue with the function I call via the onClose event producing a loop that ends in a maximum call stack exceeded error.
To clarify what I do: I create the popup via a function and that works fine. It checks if a cookie has been set with a value of "shown" and it only actually runs if that isn't found.
Then I have this seperate function that closes it which is what I am calling from the onClose event. I use this function because I need to now update the cookie to stop the popup appearing again