jquery - 如何优雅地展开 jQuery UI 工具提示?

标签 jquery jquery-ui hover jquery-ui-tooltip

我有以下页面:

<!DOCTYPE html>
<html>
    <head>
        <title>The Divine Liturgy</title>
        <meta charset='utf-8'>
        <style type='text/css'>
            body
                {
                font-family: Verdana, Arial, sans;
                }
            .ui-tooltip, .ui-widget, .ui-corner-all, .ui-widget-content,
            .ui-tooltip-content
                {
                background-color: #ffff00;
                width: 800px;
                }
        </style>
        <link rel='stylesheet' type='text/css'
        href='/js/jquery-ui-1.10.2.custom/css/smoothness/jquery-ui-1.10.2.custom.css'
        />
    </head>
    <body>

<p title="Bless, Master!">Deacon: Blagoslavie, Vladyko!</p>

<p title="Blessed is the Kingdom of the Father, and of the Son, and of the Holy Spirit: Now and ever, and unto the ages of ages.">Priest: Blagoslovenno tsarsvo Otsa i Sina, i Svatago Duha, nine e presno, i vo beki vekov.</p>

<p title="Christ is risen from the dead, trampling down death by death, and on those in the tombs bestowing life!">Clergy: Hristos voskrece iz mertvih, smertyio smert poprav, i sushim vo grodex zhevot darovav!</p>


        <script src='/js/vendor/jquery-1.8.2-min.js'></script>

        <script
        src='/js/jquery-ui-1.10.2.custom/js/jquery-ui-1.10.2.custom.min.js'></script>
        <script>
            jQuery(document).tooltip();
        </script>
    </body>
</html>

我已经在 CSS 类上尝试了几种排列,它目前的行为是根据需要以更宽的宽度显示黄色背景悬停,但黑色和白色边框区域也没有扩展 - 因此工具提示悬停在内容溢出了右边界——不符合预期。

如何要求包含框适合 800px 内部包含 div?

谢谢

最佳答案

在这里,您将 800px 宽度应用于内容,但是,.ui-tooltip 类是在 jqueryui css 中使用 max-width:300px; 定义的文件。 您的 width: 800px; 无效。

您必须分离您的类并覆盖 max-width :

body
            {
            font-family: Verdana, Arial, sans;
            }
        .ui-tooltip{
            max-width: 800px;
            width: 800px;
            }
        .ui-tooltip-content{
            background-color: #ffff00;
            }

不要覆盖ui-cornerui-widget...或其他类。您稍后可能需要它们。只需修改此处涉及的 ui-tooltip 即可;)。

关于jquery - 如何优雅地展开 jQuery UI 工具提示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16565053/

相关文章:

javascript - 如何动态获取两个文本框?

javascript - 移动导航在滚动时消失

javascript - Jquery 菜单 fadeIn fadeOut with Timer

jquery-ui - 如何允许使用 jquery ui 组合框仅选择预定义选项?

javascript - jQuery "hover state"- 测试元素是否不再悬停在其上

javascript - 如何分割数组内的数据

javascript - jquery的hover函数可以传递变量吗

Drupal 中的 Jquery 持久可排序对象?

objective-c - 获取 NSButton 上的悬停事件以显示图像

css - ul ul li a 对颜色没有反应