jQuery: How to remove the tipsy tooltip?

前端 未结 9 1871
盖世英雄少女心
盖世英雄少女心 2021-01-08 01:17

I add the tipsy tooltip to divs with the .placeTaken class. The user can then drag boxes around, so I remove the class and add it to a new div instead. When this happens, I

9条回答
  •  滥情空心
    2021-01-08 02:02

    I saw this question after Googling a situation to disable Tipsy when on a mobile device due to complexities with the touch/click event, specifically on iPads.

    The solution I decided to implement was adding a small test at the top of the jquery.tipsy.js file.

    To disable Tipsy on touch (mobile) devices: var deviceAgent = navigator.userAgent.toLowerCase();

    var isTouchDevice = Modernizr.touch ||
    (deviceAgent.match(/(iphone|ipod|ipad)/) ||
    deviceAgent.match(/(android)/) ||
    deviceAgent.match(/(iemobile)/) ||
    deviceAgent.match(/iphone/i) ||
    deviceAgent.match(/ipad/i) ||
    deviceAgent.match(/ipod/i) ||
    deviceAgent.match(/blackberry/i) ||
    deviceAgent.match(/bada/i));
    
    function Tipsy(element, options) {
        this.$element = $(element);
        this.options = options;
        this.enabled = !isTouchDevice;
        this.fixTitle();
    };
    

    See: The best way to detect if user agent supports touch

提交回复
热议问题