Implementing Bootstrap tooltips in content that can be scrolled

I need help with positioning two containers, which you can view in this FIDDLE.

Both containers may contain a lot of content, so I have applied overflow: auto to both of them.

This is the HTML structure:

<div id="maincontainer">
    <div id="left-container" class="go-left overflow-y-auto">
        <div id="left-inner-container">Contents</div>
    </div>
    <div id="right-container" class="go-right overflow-y-auto">
        <div id="right-inner-container">
            <div id="button-wrapper">
                <button type="button" id="tip_button" class="btn primary customized-button">tip</button>
            </div>
        </div>
    </div>
</div>

The issue I'm facing involves a button within the #right-container that triggers a tooltip on click. The problem arises when there is enough content to generate a scroll bar – the tooltip does not stay aligned with the button while scrolling. Instead, it remains aligned with the #maincontainer. If I set it to be relative to #right-container, it gets cut off due to the overflow.

My goal is to have the tooltip positioned next to the button even when the user scrolls down.

Answer №1

For those utilizing Bootstrap tooltip, simply include the class 'bootstrap-demo' to the parent division of the button and ensure that you do not include the container:'body' parameter during tooltip initialization.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The art of combining arrays of objects while eliminating duplicates

I am in need of a solution to compare two object arrays, remove duplicates, and merge them into a single array. Although I am relatively new to javascript/Typescript, I have come across some blogs suggesting the use of Map, reduce, and filter methods for t ...

A guide to fetching API Response by clicking a button

I'm trying to access a Public Quote JSON API and display the data on my HTML page. Even though I have some knowledge of JQuery Ajax method, my code seems to be facing issues in pulling the data into HTML. I'm looking for an explanation on what mi ...

Highlighting table rows on mouseover using CSS

I am trying to add a hover effect to my table rows, but when I apply the CSS styles for this behavior, the rows start wrapping. Here's a comparison of how the table rows look before and after applying the styles. You can see the wrapping issue in the ...

What could be the reason for data.map not being recognized as a function?

I developed the following React component: import React, { useState } from 'react'; export default function Example(){ var friend = function (id, firstName, lastName){ this.id = id; this.firstName = firstName; this.lastName = lastN ...

Creating messages from an array using vanilla JavaScript or jQuery

I have an array of objects containing messages that I want to display on my webpage, but I'm unsure how to approach it. [{"message":"dwd","user":"csac","date":"07.04.2021 20:46"}, {"mes ...

Incorporating an HTML file into a DIV container while also displaying menu links

I am facing a major challenge with what I recognize as a relatively simple issue for experts. As someone who is still learning, I am struggling to create menu links that load an HTML file into a specific DIV. Despite my efforts, the content keeps loading i ...

Background color set for only half of the div

Is it possible to achieve a design similar to this using CSS, with a Half-background color for a div? ...

What could be preventing the background image from displaying properly?

I had the idea to create a game where players have to flip cards to reveal what's on the back, but I'm struggling to get the background image to display properly. As a newcomer to Vue, I'm not sure if I made a mistake somewhere. My intuition ...

Issues with Braintree webhooks and CSRF protection causing malfunction

I have successfully set up recurring payments with Braintree and everything is functioning properly. Below is an example of my code: app.post("/create_customer", function (req, res) { var customerRequest = { firstName: req.body.first_name, lastN ...

Using jQuery to present JSON data on a website

I am currently working on a project that involves outputting the company name and number for each company. Once I have this data, I plan to display it in a list within my div element. My knowledge of jquery, Ajax, and Json is limited, so I'm feeling a ...

Obtain access to the DOM element using template reference variables within the component

Searching for a method to obtain a reference to the DOM element for an Angular 2 component through a template reference variable? The behavior differs when working with standard HTML tags versus components. For example: <!--var1 refers to the DOM node ...

Displaying a div on click is simple with CSS and JQuery, but what if you want it to stay visible even after a second click? By utilizing classes within <li> tags instead of buttons

My current code involves clicking on a menu, which should reveal a list where each item has a corresponding section that slides down and slides back up when clicked. However, only the sliding down functionality is working at the moment. I'm new to jQu ...

Manipulating arrays of objects with handlebars.js

I need help with my node.js app that is returning JSON data for computers. { computers: { john: { cpu: "intel", ram: "8MB", hd: "1TB" }, jane: { cpu: "intel", ram: "12MB", hd: "500GB" }, mary: { ...

Storing map tiles offline in React-Leaflet

One common method I have come across for storing tiles offline with Leaflet involves using localforage. Here's an example: const map = L.map("map-id"); const offlineLayer = L.tileLayer.offline('https://server.arcgisonline.com/ArcGIS/res ...

Dealing with a socket.io CORS problem

After deciding to implement a websocket on my website, I opted to utilize the socket.io library. However, I've encountered a CORS error: Access to XMLHttpRequest at 'http://localhost:2021/socket.io/?EIO=4&transport=polling&t=NlbFGS2&apos ...

You can only use RSA and DSA public keys during the babel-node installation process

I'm having difficulties with the installation process of babel-node npm i -g babel-node > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="53313231363f7e3d3c373613657d67d75716b70793f777b79">[email protected]< ...

The function `React.on('languageChanged')` is not effectively detecting changes in the language

I'm new to working with React and I'm looking for the best way to detect when a user changes their language preference. I am currently using next-translate to handle translations, but for some resources that come from an API, I need to update the ...

What is the best way to extract the ID of an element that triggers an OnChange event?

Just a heads up: The solution to my problem ended up being CSS code that was triggered by clicking on a widget. Once I realized it was CSS, along with the widget name and hover action, I was able to handle it successfully. Previous question before the PS ...

Troubleshooting: Bootstrap update functionality is only functional in Debug configuration in Visual Studio

I recently made the switch from Bootstrap 2 to Bootstrap 4, updating the syntax, grids, and other elements. While everything was working fine in debug mode, I encountered an issue when trying to release the website. Even though there were no errors during ...

A div positioned in front of a centrally-located div

Managing a website with numerous headlines can be a challenge. When a user clicks on a headline, a button located 10px to the left of the headline should appear. However, the catch is that the headlines must always remain centered, regardless of whether th ...