jQuery工具工具提示不会消失

如何解决jQuery工具工具提示不会消失

| 我有一个工具提示,该提示会出现在带有标题的所有内容上:
$(\"[title!=]:not(IFRAME)\").tooltip();
我有一个可以添加或删除的人员列表,单击位于该人员上方的删除按钮,然后单击将其替换为另一个人员。 当您单击“删除”按钮时,将显示工具提示,因为该项目带有。但是,一旦您将该人换掉,工具提示将不会消失。 我非常确定,原因是该人被删除后就不会有鼠标移开,因此工具提示永远不会消失。 我尝试了这个:
$(\'.remove-player-large a\').click(function() {
  $(\"[title!=]:not(IFRAME)\").tooltip().hide();
});
但是没有运气 对于如何解决这个问题,有任何的建议吗? 这有意义吗?     

解决方法

您可以使用hideTooltip()函数隐藏工具提示。
var $tooltip = null;
$(function(){
    $tooltip = $(\"input[type=\'text\']\").tooltip({
        // place tooltip on the right edge
        position: \"center right\",// a little tweaking of the position
        offset: [-2,10],// use the built-in fadeIn/fadeOut effect
        effect: \"fade\",// custom opacity setting
        opacity: 0.6
    });
    $(\"#close\").click(function(){
        hideTooltip();
    });
});
function hideTooltip()
{
    if($tooltip)
    {
        $tooltip.each(function(index){
            var $this = $(this).data(\'tooltip\');
            if($this.isShown(true))
                $this.hide();
        });
    }
}
    ,jqueryUi工具提示存在ipad问题,如果我们单击页面上的任意位置,工具提示不会消失,因此此简单的解决方案适用于我并在ios 6,ios 7,ios 8设备上工作
 $(\"#selector \").tooltip( \"close\" );
,删除工具提示元素以及链接。
$(\'.remove-player-large a\').click(function() {
  $(\'.tooltip\').remove();//remove the tool tip element
});
如果您不知道工具提示元素的类名称,则需要使用Firebug进行检查,或者可以在工具提示源代码中找到它     ,我遇到了同样的问题,并且我发现这里没有有效的解决方案,对上述问题的正确答案是使用JQuery工具api获取正确的tooltip元素,然后在删除所有者之前删除它工具提示。
var t = $(\'#object_to_remove\').data(\'tooltip\');
if(t) t = t.getTip();
if(t) t.remove();
$(\'#object_to_remove\').remove();
if(t)块是必需的,这样,即使未附加工具提示或尚未调用工具提示,也不会出错。 由于它们是懒惰地添加到DOM的,因此t.getTip可能返回undefined(这意味着工具提示数据仍驻留在title属性中,因此无需清理,因为它将被拥有的DOM元素删除)。     ,我认为最干净的方法是调用以下命令:
$(\"#your-element\").tooltip(\'destroy\');
简而言之,它将删除您当前的工具提示功能,并且ѭ7会恢复为正常状态。 这是一个官方文档:https://api.jqueryui.com/tooltip/#method-destroy     ,在删除此人之前,请将其发送给.mouseout()事件。这将触发工具提示的正常鼠标移出行为,并应隐藏工具提示(如果在鼠标移开时确实消失了)     ,jqueryui工具提示和iPad的一些相关问题在这里得到了很好的回答     

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-