I am using bootstrap 3.3 tooltips and had an issue with the tooltips being cropped/hidden. I solved this by setting data-container="body"
.
<!--...-->
<span class="callOutImg">
<a href="#" data-toggle="tooltip" data-container="body" data-placement="top" class="optionTooltip" title="Hello my name is Inigo Montoya">
<img src='/images/info-bubble-big.png' />
</a>
</span>
<!--...-->
Using these effects all of my tooltips - which is not what I want.
However, I want to set a specific style on the .tooltip-inner only for a subset of tooltips on the page. These tooltips are now however contained in body
so the scope is more or less global.
I can only access .tooltip-inner for these using:
body .tooltip-inner {
background-color: #40a0d0;
}
or
.tooltip-inner {
background-color: #40a0d0;
}
How do I set a different data-container
? (I have tried classes and id's) Or can anyone suggest a way to limit the scope of .tooltip-inner
selection?
Bootstrap Tooltip displays informative text when users hover, focus, or tap an element. They display text tips next to the element in question. Documentation and examples for adding custom tooltips with CSS and JavaScript using CSS3 for animations and data-mdb-attributes for local title storage.
The Tooltip component is small pop-up box that appears when the user moves the mouse pointer over an element: To create a tooltip, add the data-toggle="tooltip" attribute to an element.
Use the title attribute to specify the text that should be displayed inside the tooltip: Note: Tooltips must be initialized with jQuery: select the specified element and call the tooltip () method.
To create a tooltip, add the data-toggle="tooltip" attribute to an element. Use the title attribute to specify the text that should be displayed inside the tooltip:
There is a way to add a css class to a tooltip based on which element it is attached to, even if you have set data-container="body"
on the element.
$('.element1')
.tooltip()
.each(function() {
$(this).data('bs.tooltip').tip().addClass('tooltip-class1');
});
See a working example here
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With