Tooltip only showing in top in Bootstrap 5

587 Views Asked by At

Hi I'm working in Laravel 7 with the Currently v5.1.3 Bootstrap... I'm using the bootstrap.bunble.min.js file. Calling the tooltip function via the data-bs-toggle attribute:

    <span class="badge-sale"
    data-bs-toggle="tooltip"
    title="Ends in 3 hours from now">
    Sale!</span>

and the initializator of tooltip in my js file:

var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl)
})

ONLY in the top of the web tooltip is displayed correctly but when I scroll further down it is no longer displayed.

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

Bootstrap's .container-fluid class has been used, so this is passed as a container parameter when initialising Tooltip, modifying it would look like this:

var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
var tooltipList = tooltipTriggerList.map(function (tooltipTriggerEl) {
return new bootstrap.Tooltip(tooltipTriggerEl,{
    container: '.container-fluid'
 });
});