Search code examples
javascriptjqueryfancybox

Fancybox 3 not removing touch feature


On click of an area, a Fancybox(v3) is opened up which I have an option of touch:false to prevent the user from swiping Fancybox away as this is causing issues with the Datetime picker that is used within the Fancybox. Below I have the following:

$.fancybox.open({
    type: "ajax",
    src: "/forms/add_user_to_session.php",
    ajax: { 
        settings: { 
            data : data, 
            type : 'POST'
        }
    },
    opts: { 
        touch : false 
    }
});

But for some reason, the touch:false does not make any difference I have tried putting touch:false outside of the opts but still no change. Any help would be much appreciated.


Solution

  • I think touch has to be one level higher, like this:

    $.fancybox.open({
      type: "ajax",
      src: "/forms/add_user_to_session.php",
      ajax: {
        settings: {
          data: data,
          type: "POST"
        }
      },
      touch: false
    });
    

    Here the codepen I tested with: https://codepen.io/Sixl/full/JxpwxY