工具提示在 Safari/iPad 上无法按预期工作

编程入门 行业动态 更新时间:2024-10-27 20:26:51
本文介绍了工具提示在 Safari/iPad 上无法按预期工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我尝试了不同形式的工具提示,它们在 Chrome、浏览器、Android 等中都可以正常工作.

I have tried different forms of tooltip, and they all work fine in Chrome or in browsers, on android etc..

但是当涉及到 iPad、iPhone 和 safari(有时甚至是 chrome)时,我遇到了一个问题,即按钮上的工具提示突然需要点击 2 次才能按下按钮.一键弹出工具提示,另一次按下按钮.

But when it comes to iPad, iPhone and safari (sometimes even chrome) I get the problem that tooltip on a button will suddenly require 2 clicks to press the button. One click brings up the tooltip and the other press the button.

<button href="#mail-wrapper" 
        class="book-button book-text-button col-std-mail" 
        ng-click="vm.mailButton=true;" 
        uib-popover="Send Mail to Tenant" 
        popover-trigger="'mouseenter'">
        <md-icon class="material-icons book-material" aria-label="Mail" role="img">mail</md-icon>
        MAIL
</button>

有人对适用于 safari/iOS 的 angular、jquery、js 的工具提示组件有什么建议吗?`

Does anyone have a suggestion to a tooltip component for angular, jquery, js which works on safari / iOS?`

推荐答案

我看到了同样的行为,在链接上使用 bootstrap4 和工具提示.

I see the same behavior, using bootstrap4 and tooltips on links.

<script>$(function () {$('[data-toggle="tooltip"]').tooltip()})</script>
<a href="mylink" data-toggle="tooltip" data-placement="bottom" title="my tooltip text">my link or icon</a>

结果:点击 1 仅触发工具提示.没有关注链接.需要第二次点击才能触发链接.

Result: Tap 1 triggers the tooltip only. The link is not followed. A 2nd tap is required to triggers the link.

别问我为什么,我终于用这个配置解决"了:

Don't ask me why, but I finally "solved" it using this configuration:

将以下 CSS 类添加到我的链接光标:指针向工具提示调用添加一些配置:trigger:"hover"delay:{"show":400,"hide":800}

完整的解决方案是

<script>$(function () {
    $('[data-toggle="tooltip"]').tooltip({trigger:"hover",
                                          delay:{"show":400,"hide":800}})})</script>
<a href="mylink" class="perso-IOSpointer" data-toggle="tooltip" data-placement="bottom" title="my  tooltip text">my link or icon</i></a>

我试图改变延迟,这是我对几部 iPhone 的观察

I tried to change the delay an here are my observation on several iPhones

无延迟:需要点击 2 次"show":100:需要 2 次点击"show":300:需要 1 次点击 no delay: 2 taps required "show":100: 2 taps required "show":300: 1 tap required

我最终将其设置为 400 毫秒,似乎没问题.

I finally set it to 400ms and it seems to be fine.

这篇关于工具提示在 Safari/iPad 上无法按预期工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-30 03:13:56,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1388225.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:提示   工具   工作   Safari   iPad

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!