你可以使用jQuery UI Tooltip並確保如下工具提示在網頁中的任何觸摸關閉:
initTooltip = function ($el) {
var closeTooltipOnClick = function (e) {
// This code if for touch devices only.
// We want to tooltip to close, when we touch
// anywhere on the page, except if we touch on
// the link itself.
if ($(e.target).closest($el).size()) {
// We just clicked on the link, so let's
// not close the tooltip.
return;
}
$('body').off('touchend', closeTooltipOnClick);
$el.tooltip('close');
};
$el.tooltip({
open: function() {
if (!Modernizr.touchevents) {
return;
}
// We make sure that the tootlip closes on
// touch devices if there is a touch event anywhere.
$('body').on('touchend', closeTooltipOnClick);
}
});
};
任何運氣找到一個解決方案? –