Skip to main content
Known Participant
December 4, 2020
Question

Javascript: Turning off mobile gestures on specific page

  • December 4, 2020
  • 1 reply
  • 236 views

I've added some of my own HTML elements to a course, this works fine when mobile gestures are off. But when they are on the elements cannot be clicked. I'm hoping to be able to turn this feature off for a specific slide if it's possible to get at that property. 

 

This is the portion of CPM.js that is added when this feature is enabled, does anyone know how b.defaults.stop_browser_behavior can be changed by Javascript?

 

(function (im) {
  var b = function (ac) {
    return new b.Instance(ac || {});
  };
  b.defaults = {
    stop_browser_behavior: {
      userSelect: "none",
      touchAction: "none",
      touchCallout: "none",
      contentZooming: "none",
      userDrag: "none",
      tapHighlightColor: "rgba(0,0,0,0)",
    },
  };
  b.HAS_POINTEREVENTS =
    i.navigator.pointerEnabled || i.navigator.msPointerEnabled;
  b.HAS_TOUCHEVENTS = "ontouchstart" in i;
  b.MOBILE_REGEX = /mobile|tablet|ip(ad|hone|od)|android|silk/i;
  b.NO_MOUSEEVENTS =
    b.HAS_TOUCHEVENTS && i.navigator.userAgent.match(b.MOBILE_REGEX);
  b.EVENT_TYPES = {};
  b.DIRECTION_DOWN = "down";
  b.DIRECTION_LEFT = "left";
  b.DIRECTION_UP = "up";
  b.DIRECTION_RIGHT = "right";
  b.POINTER_MOUSE = "mouse";
  b.POINTER_TOUCH = "touch";
  b.POINTER_PEN = "pen";
  b.EVENT_START = "start";
  b.EVENT_MOVE = "move";
  b.EVENT_END = "end";
  b.DOCUMENT = i.document;
  b.plugins = b.plugins || {};
  b.gestures = b.gestures || {};
  b.READY = !1;
  b.utils = {
    extend: function (abd) {
      for (var e in b) (a[e] !== m && d) || (a[e] = b[e]);
      return a;
    },
    each: function (abd) {
      var ef;
  etc etc
    },
  };
  "function" == typeof define && define.amd
    ? define(function () {
        return b;
      })
    : "object" === typeof module && module.exports
    ? (module.exports = b)
    : (i.Hammer = b);
})(window);
    This topic has been closed for replies.

    1 reply

    Paul Wilson CTDP
    Community Expert
    Community Expert
    December 6, 2020

    Perhaps I don't fully understand the problem but each slide does have a check box in the Properties Inspector to Allow Gesture Navigation. On a slide by slide basis, this can be unchecked. 

     

    Paul Wilson, CTDP
    Known Participant
    December 7, 2020

    Ha ha wow that is a good solution, thank you!! Can't believe I didn't even check properly, must be too overworked 😄


    Paul Wilson CTDP
    Community Expert
    Community Expert
    December 7, 2020

    Yeah as a 15 year veteran with Captivate I'm pleased but slightly embarrassed when I learn something that I should have known before. Happens to all of us. 

    Paul Wilson, CTDP