jquery - 重写 bootstrap Tooltip.prototype.fixTitle() 方法

标签 jquery twitter-bootstrap tooltip twitter-bootstrap-tooltip bootstrap-tour

您好,我在我的网站中使用Bootstraptour,我想重写以下方法

  Tooltip.prototype.fixTitle = function () {
    var $e = this.$element
    if ($e.attr('title') || typeof ($e.attr('data-original-title')) != 'string') {
      $e.attr('data-original-title', $e.attr('title') || '').attr('title', '')
    }
  }

你能解释一下如何覆盖这个吗?

如果我不编写此函数的代码,那么我的弹出窗口可以正常工作。它向我显示标题作为一个集合,如

    {
        element:   '.modal-content .existing-attachments img:eq(2)',
        placement: 'top',
        title:     _t("Select Cover"),
        content:   _t("Select the approprite cover."),
        popover:   { fixed: true },
    },

但是由于此功能,它不会显示我在选项“选择封面”中设置的标题,它会显示我想要设置弹出框的图像的标题。

<img class="img img-responsive" src="/website_blog/static/src/img/library/woodtexture.jpg" alt="Wood Wall Texture" title="Wood Wall Texture">

你能帮我吗?

最佳答案

您可以使用$.fn.tooltip.Constructor.prototype访问Tooltip的所有原型(prototype)函数

关于jquery - 重写 bootstrap Tooltip.prototype.fixTitle() 方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25913925/

相关文章:

jQuery Simpletip 插件使用 title 属性

javascript - 从 .html(或innerHtml)将结果输入到数组并使其工作

html - Bootstrap 表单组布局中断

javascript - 插入这个条件语句最优雅的方式是什么?

javascript - 如何将 setInterval 和 .on ("click") 函数连接在一起?

javascript - 循环链表未按预期工作(jquery)

单击按钮时过滤下拉列表的 jQuery 和 Bootstrap 文本字段

css - jQuery/bootstrap 方式在网站页面上创建促销幻灯片

python-3.x - 仅在文本小部件中的文本上显示 Tkinter 工具提示

visual-studio - Visual Studio 2010 智能感知工具提示延迟