jquery-powertip icon indicating copy to clipboard operation
jquery-powertip copied to clipboard

Using PowerTip with SVG on touch screens

Open BradyStephenson opened this issue 10 years ago • 2 comments

First... THANK YOU for such a fantastic plugin that does so much without being overwhelming AND that isn't abandonware. ;)

I'm putting together a site called MessiahsPassoverWeek.info and PowerTip is perfect for what I needed to accomplish. It works great on computers but I'm having an issue in that I can't seem to get the PowerTips to work with SVG elements on tablets/touch screens. Is there a trick to getting the PowerTips to show up on the touch of an SVG element?

Thanks again!

BradyStephenson avatar Apr 14 '14 20:04 BradyStephenson

I haven't done much testing with PowerTip in touch environments. There are some hurdles with touch that PowerTip doesn't specifically work around. Generally a tap will cause the mouseover event to fire, but in touch environments it might be better to hook to click and/or directly to touch events. However, PowerTip doesn't listen for those by default.

I'll do some investigation.

stevenbenner avatar Apr 26 '14 19:04 stevenbenner

In case it's useful to anyone, I wanted to have powerTip open a little more smoothly on touch-based devices (although I'm not using SVG elements). So far I have:

if ('ontouchstart' in document.documentElement) {
    // This is a touch-based device.
    $('body').on('touchstart', '.js-tt', function() {
        $(this).powerTip('show');
    });
};

Where the .js-tt class is on all of my elements that should have tooltips.

This seems to work - powerTip opens less sluggishly than when relying on the device's touch-based substitute for hovering. But there is a bit of a flicker, which suggests the original event is still firing and (maybe) opening powerTip again? I'm not sure what that original event is, or how to disable it.

philgyford avatar May 27 '15 16:05 philgyford