Jef*_*den 47 css jquery twitter-bootstrap twitter-bootstrap-tooltip
我试图在twitter bootstrap工具提示中显示一些长文本.正如你在下面的图片中看到的那样,事情并没有发生.有没有人可以轻松修复溢出引导工具提示的文本?

编辑(添加请求的代码):
在我的控制器中:
<a href='" + Url.Action("Index", "PP", new {id = productRow.ProductGuid, area = ""}) + "' " + 
          ((blTruncated) ? "class='auto-tooltip' title='" + productRow.ProductName.Replace("'", "") : "") + "'>" + 
           productName + "</a>
在我看来:
$('.auto-tooltip').tooltip();
fun*_*err 95
我不太确定你的代码,
这里有一个长工具提示值的例子:    
元件:
 <a href="#" rel="tooltip" title="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas bibendum ac felis id commodo. Etiam mauris purus, fringilla id tempus in, mollis vel orci. Duis ultricies at erat eget iaculis.">Hover here please</a>
JS:
$(document).ready(function () {
  $("a").tooltip({
    'selector': '',
    'placement': 'top',
    'container':'body'
  });
});
CSS:
/*Change the size here*/
div.tooltip-inner {
    max-width: 350px;
}
演示:在JsBin.com上
cmc*_*loh 29
正如在文档中暗示的那样,确保工具提示完全不包装的最简单方法是使用
.tooltip-inner {
    max-width: none;
    white-space: nowrap;
}
有了这个,你不必担心尺寸值或类似的东西.主要的问题是如果你有一个超长的文本行,它将离开屏幕(你可以在JSBin示例中看到).
您可以使用此源获得更好的结果:
.tooltip-inner {
 word-break: break-all;
}
作为在样式表中设置样式的替代方法,您可以通过修改工具提示的模板.tooltip-inner将样式直接添加到工具提示。
在大多数情况下,这可能不是一个好主意,因为您将直接将样式应用到元素,但值得注意的是,对于少数情况,这是唯一的选择或由于某种原因是最佳选择,这是可能的。
$(selector).tooltip({
  title: "Lorem ipsum ...",
  template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner" style="max-width: none;"></div></div>',
});
或者,作为属性:
<span
  data-toggle="tooltip"
  title="Lorem ipsum ..."
  data-template='<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner" style="max-width: none;"></div></div>'
  >Some abbreviation</span>
$(function(){
  $('[data-toggle="tooltip"]').tooltip();
});
template选项:
创建工具提示时使用的基本 HTML。
工具提示
title将被注入到.tooltip-inner.
.tooltip-arrow将成为工具提示的箭头。最外面的包装元素应该具有该类
.tooltip。
默认为:
'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>'
作为替代方案,您可以将自己的类添加到模板中并设置自定义类的样式。
$(selector).tooltip({
  title: "Lorem ipsum ...",
  template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner my-custom-tooltip"></div></div>',
});
.my-custom-tooltip {
  max-width: none;
}
| 归档时间: | 
 | 
| 查看次数: | 88723 次 | 
| 最近记录: |