ouibounce icon indicating copy to clipboard operation
ouibounce copied to clipboard

Dynamic checking based on DOM attribute

Open nikosd opened this issue 11 years ago • 0 comments

It would be really handy to be able to enable/disable dynamically whether a modal should be opened without having to use the ouibounce API and/or disabling it permanently through the cookie.

This is my current local patch but I'm not sure this is the best approach:

  function handleMouseleave(e) {
    if (e.clientY > sensitivity || (checkCookieValue(cookieName, 'true') && !aggressive)) return;

    _delayTimer = setTimeout(_fireAndCallback, delay);
  }

is changed to:

  function handleMouseleave(e) {
    if (e.clientY > sensitivity || (checkCookieValue(cookieName, 'true') && !aggressive)) return;
    if (el && el.getAttribute('data-ouibounce-disabled') === "true") return;

    _delayTimer = setTimeout(_fireAndCallback, delay);
  }

This way when the modal element has the data attribute "data-ouibounce-disabled" set to "true" the modal won't popup.

nikosd avatar Nov 28 '14 10:11 nikosd