Popup-swipe-to-close dynamic popup not working?

I have a popup that I would like to swipe to close and I have the following but it is not closing it when I swipe down on it?

I have this dynamic popup.

var swipeToClosePopup = app.popup.create({
  content: '<div class="popup popup-swipe-to-close">'+
              '<div class="block">'+
                '<p>Popup created dynamically.</p>'+
                '<p><a href="#" class="link popup-close">Close me</a></p>'+
  $el: '.popup-swipe-to-close',
  swipeToClose: true,
  // Events
  on: {
    open: function (popup) {
      console.log('Popup open');
    opened: function (popup) {
      console.log('Popup opened');
// Events also can be assigned on instance later
swipeToClosePopup.on('close', function (popup) {
  console.log('Popup close');
swipeToClosePopup.on('closed', function (popup) {
  console.log('Popup closed');
// Open dynamic popup
$$('.dagensannons-popup').on('click', function () {

I think the docs says that I should use el: '.popup-swipe-to-close', instead of $el: '.popup-swipe-to-close', but then I get this error.

TypeError: undefined is not an object (evaluating 'n.eventsListeners[e]')
TypeError: undefined is not an object (evaluating 'a.params.animate')

Not sure what Im missing here so any input appreciated, thanks.

Only content or el parameter can be specified. I guess in your case it is only content. And make sure you are on v5

Ok than I understand, thanks a lot Vladimir :slight_smile: