微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

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

disabled="disabled" title="This a test disabled button." value="hover me please">   ottom-20",at: "center top",using: function (position,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.jb51.cc/jquery/428767.html

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

相关推荐