禁用按钮上的Jquery UI工具提示

前端之家收集整理的这篇文章主要介绍了禁用按钮上的Jquery UI工具提示前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我正在尝试显示禁用按钮的工具提示.我不确定jquery事件是否会激活已禁用的元素,但我正在尝试检查是否可以显示已禁用项目的工具提示.我的例子是here

Feedback) {
                $(this).css(position);
                $("Feedback.vertical)
                    .addClass(Feedback.horizontal)
                    .appendTo(this);
            }
        }
    });
});
最佳答案
看起来不能保证正常工作.

见文档(http://api.jqueryui.com/tooltip/):

In general,disabled elements do not trigger any DOM events. Therefore,it is not possible to properly control tooltips for disabled elements,since we need to listen to events to determine when to show and hide the tooltip. As a result,jQuery UI does not guarantee any level of support for tooltips attached to disabled elements. Unfortunately,this means that if you require tooltips on disabled elements,you may end up with a mixture of native tooltips and jQuery UI tooltips.

编辑:解决这个问题的一种方法是,不要将按钮设置为禁用,而是将其设置为样式,使其看起来像是已禁用.如果它是一个简单的按钮,那就是你所要做的,如果它是一个提交按钮,你还必须阻止它提交表单.

编辑#2:我尝试了上面的解决方法,看起来不透明:0.5几乎完成了工作(来源:tjvantoll.com):

.disabled-button {
    opacity: 0.5;
}

这是你更新的小提琴:http://jsfiddle.net/jkLzuh0o/3/

原文链接:https://www.f2er.com/jquery/428767.html

猜你在找的jQuery相关文章