I have a JSFiddle here:
At the moment, both tooltips wrap.
I can get both tooltips to wrap by following:
How do you change the width and height of Twitter Bootstrap's tooltips?
.tooltip-inner {
max-width: 350px;
width: 350px;
}
but this causes both tooltips not to wrap.
How do I get just the first tooltip not to wrap?
2
Answers
I would use template in options to apply different html content with different classes for wrap and nowrap like below:
http://jsfiddle.net/9k3Lbtr6/1/
Bootstrap allows you to render your tooltip with rich HTML content by leveraging the
html:
option. As such, you can replace normal whitespace characters with non-breaking white-space characters to force content not to wrap.You could leverage jQuery’s
$.each()
function and a simple regex.replace()
to automate this process. Add classes on the button to determine when to apply the forced one line. You will have to make the window narrow (horizontally) to see the effect.http://jsfiddle.net/dixalex/vqgj8brs/1/