显示禁用物品的工具提示 [英] Show tooltip for disabled items

查看:88
本文介绍了显示禁用物品的工具提示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个禁用项目的div.我正在使用jquery ui来显示工具提示.显示的工具提示适用于启用的项目,但不适用于禁用的div.我如何也显示禁用div的工具提示? 这是我的小提琴

I have a div with disabled items. I am using jquery ui to display tool tip. Tool tip is shown for enabled items but not for disabled div. How can I show tooltip for disabled div also? Here is my fiddle

<div title="This is a tool tip test for enabled item" id="divEnabled">
    item is enabled
</div>

<div title="This is a tool tip test for disabled item" id="divDisabled">
    item is disabled
</div>


#divDisabled{
     opacity: 0.2;
    pointer-events: none;
}

推荐答案

您正在将指针事件设置为none,因此不会触发悬停事件.这就是为什么标题没有显示的原因.也许您应该找到另一种禁用" div的方法.

You are setting pointer events to none so the hover event is not fired. Thats why title is not shown. Maybe you should find another way to "disable" the div.

如果您只想停止div上的click事件

If you just want to stop click event on the div

<div title="This is a tool tip test for disabled item" id="divDisabled" onclick="return false;">
    item is disabled
</div>

会的.

但是通常单击div是没有用的,所以也许您会解释单击div会做什么,并且防止此操作会有所不同.

But normally it is useless to click on a div so maybe you would explain what are you doing on click of the div and preventing this action would be different.

这篇关于显示禁用物品的工具提示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆