【问题标题】:Jquery tooltip on dialog close button对话框关闭按钮上的 Jquery 工具提示
【发布时间】:2013-08-14 13:43:11
【问题描述】:

在我正在处理的 Web 应用程序中,我通过 JqueryUI 对话框在“详细信息”页面上显示部分视图。我正在尝试在标题的右上角为关闭按钮添加一个 JqueryUI 工具提示,该工具提示与对话框一起提供。下面我有一些我的代码。由于我在下面的第二个功能,我知道脚本将从它们当前在此 Web 应用程序中的位置开始工作。 '.ui-dialog-titlebar-close' 是应用于对话框标题中关闭按钮的类(基于 chrome firebug)。我找到的最接近解决方案的答案是https://forum.jquery.com/topic/tooltip-in-a-dialog-pop-up-without-hovering

发现这个问题与我的类似... How to change the 'X' button in a jquery dialog box to read 'Close' ...我可以通过任何方式操纵关闭按钮来实现我这样的要求吗?例如“.addTitle()”??即将修改这个想法。

感谢所有帮助或信息。

<script>
    $(function() {
    $('.ui-dialog-titlebar-close').tooltip({
        content: function () {
            return "test";
        }
    });
});

$(function () {
    $('#testThing').tooltip();
});

</script>

非常感谢, 摇滚

【问题讨论】:

    标签: javascript jquery jquery-ui-dialog jquery-ui-tooltip


    【解决方案1】:

    我会尝试在您的对话框中使用 create 事件:

    $("yourSelector").dialog({
       create: function(){$(".ui-dialog-titlebar-close").attr("title","Your text goes here");}
    });
    

    【讨论】:

    • 最终成为样式表的东西,覆盖了我想要的样式。不过感谢您的意见!
    【解决方案2】:

    这可以通过编辑具有

    的行来修复
    .addClass("ui-dialog-titlebar-close ui-corner-all") 
    

    在 'jquery.ui.dialog.js' 或 ('jquery.ui.all.js') 页面中,目前为

    .attr('role', 'button')
    

    直接改成

    .attr({'role': 'button', 'title': "close (Esc)")
    

    这将解决问题

    【讨论】:

      【解决方案3】:

      我认为最简单的解决方案是更新 jQuery UI 对话框的选项配置。喜欢:

      $("#dialogConfirm").dialog({
          autoOpen : false,
          modal : true,
          resizable : false,
          dialogClass : "confirm-dialog",
          closeText : "Click to Close the dialog" // Here is the Gem
      });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-04-06
        • 1970-01-01
        相关资源
        最近更新 更多