Search code examples
tippyjs

Tippy.js: Unable to disable tooltips


I want to disable tippy when on mobile. For this I have the following script. I use it like explained in the documentation of tippy:

const mytippies  = tippy('[data-tippy-content]', {
    plugins: [hideOnEsc],
});

mytippies.disable();

Doing this I get error Uncaught TypeError: (0 , o.default)(...).disable is not a function what am I doing wrong?


Solution

  • The problem here is that the instance mytippies is an array of instances. The disable method only works on a single instance. So using a for loop I can disable Tippy for all my instances:

    for (let i = 0; i < mytippies.length; i++) {
         mytippies[i].disable();
    }