我正在尝试在 Twitter Bootstrap 工具提示中显示一些长文本。正如您在下图中所看到的,事情进展得并不顺利。有没有人可以轻松修复溢出 Bootstrap 工具提示的文本?
编辑(添加请求的代码):
在我的 Controller 中:
<a href='" + Url.Action("Index", "PP", new {id = productRow.ProductGuid, area = ""}) + "' " +
((blTruncated) ? "class='auto-tooltip' title='" + productRow.ProductName.Replace("'", "") : "") + "'>" +
productName + "</a>
在我看来:
$('.auto-tooltip').tooltip();
最佳答案
我不太确定你的代码,
这是一个带有长工具提示值的示例:
元素:
<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;
}
演示:on JsBin.com
显然,您只能在 Bootstrap 4 中更改 .tooltip-inner
,感谢@Felix Dombek
.tooltip-inner { max-width: ... }
关于jquery - 在 Bootstrap 工具提示中显示长文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18517483/