简体   繁体   English

如何将jQueryUI tootip与我的自定义CSS一起使用

[英]How to use jQueryUI tootip along with my custom css

I am using jQueryUI tooltip & custom css to format it. 我正在使用jQueryUI工具提示和自定义CSS对其进行格式化。 Tooltip is coming but not able to aply my css class on top of it. 工具提示即将到来,但无法在其之上应用我的CSS类。 Code : 代码:

$(document).ready(function () {
    $("#roles").tooltip({ content: "Start typing a name for the IT role you're staffing. There are 75 to choose from. If you're uncertain, start with something general like '<i>Manager</i>'" });    
});

HTML 的HTML

<input id="roles" type="text" class="wGridPx_16"/>

CSS 的CSS

<style>
        .ui-tooltip
        {
            font-size: 11px;
            color: #fff;
            text-shadow: 0 0 2px #000;
            padding: 4px 8px;
            border: 1px solid rgba(255,255,255,0.25);
            background-color: rgb(25,25,25);
            background-color: rgba(25,25,25,0.82);
            background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000));
            border-radius: 3px;
            -webkit-border-radius: 3px;
            -moz-border-radius: 3px;
            box-shadow: 0 0 3px #555;
            -webkit-box-shadow: 0 0 3px #555;
            -moz-box-shadow: 0 0 3px #555;
        }
    </style>

Please help. 请帮忙。 I have checked many Q/A blogs on it like jquery ui tooltip custom class on page load but nothing helped me. 我已经检查了许多关于它的Q / A博客,例如页面加载时的jQuery ui工具提示自定义类,但没有任何帮助。

You can use the tooltipClass option 您可以使用tooltipClass选项

$(document).ready(function () {
    $("#roles").tooltip({
        content: "Start typing a name for the IT role you're staffing. There are 75 to choose from. If you're uncertain, start with something general like '<i>Manager</i>'",
        tooltipClass: 'my-class'
    });

});

then 然后

.my-class.ui-tooltip {
    font-size: 11px;
    color: #fff;
    text-shadow: 0 0 2px #000;
    padding: 4px 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background-color: rgb(25, 25, 25);
    background-color: rgba(25, 25, 25, 0.82);
    background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(transparent), to(#000));
    border-radius: 3px;
    -webkit-border-radius: 3px;
    -moz-border-radius: 3px;
    box-shadow: 0 0 3px #555;
    -webkit-box-shadow: 0 0 3px #555;
    -moz-box-shadow: 0 0 3px #555;
}

Demo: Fiddle 演示: 小提琴

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM