How to activate TOOLTIP with Bootstrap 4 ?

Created on 24 April 2021, over 3 years ago
Updated 8 April 2024, 8 months ago

How to activate TOOLTIP with Bootstrap 4 ?

Feature request
Status

Needs review

Version

5.0

Component

Documentation

Created by

🇫🇷France zenimagine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇮🇳India ravi kant Jaipur

    It worked for me after replace bootstrap.js cdn url in libararies.yml as below.

    Replace to

    //cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js: {}
    

    With

    //cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js: {weight: -2}
    //cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.min.js: {weight: -1}
    
  • 🇮🇳India pradipmodh13 Ahmedabad

    Hello @zenimagine,

    Regarding the Bootstrap Bario 5 theme, I noticed that Bootstrap 5 Tooltip support is not enabled by default. To enable it, please refer to the official documentation here: [Bootstrap 5 Tooltip Documentation](https://getbootstrap.com/docs/5.2/components/tooltips/). You'll need to add the specified 2-line JavaScript code to your JS file. For Ref attached screenshot(File Name: SS1) and video with working tooltip.
    If this solution will solve the issue the please proceed to update the ticket status to "Closed."
    Note: This feature is subjective, so it requires manual activation. If needed,

    @Ravi Kant,
    Upon reviewing the subtheme of the Barrio Bootstrap 5 theme, I observed that the library.yml file includes an inbuilt CDN with bootstrap.bundle.min.js, and the local already contains popper.min.js. It seems there is no requirement to update the library.yml file. For more details, please refer to the attached screenshot(File Name: SS2). Kindly verify

  • 🇬🇧United Kingdom 2dareis2do

    if you are not using bootstrap cdn then it looks to me as if the popper library is not included. This is odd as it appears to be copied across when using bootstrap sass. I ended up adding this in my libraries.yaml

    js/popper.min.js: { weight: -49 }

    so now I have

    global-styling:
      version: VERSION
      js: 
        js/bootstrap.min.js: { weight: -48 }
        js/popper.min.js: { weight: -49 }
        js/barrio.js: {}
    ...
        js/custom.js: {}

    What I am not sure about is that core/popperjs appears to be added as a dependency but this seems to have no affect on dropdowns etc afaict

    e.g.

      dependencies:
        - core/jquery
        - core/drupal
        - core/popperjs

    Also I had to add some js to me theme to get the poppers to actually work.

    e.g.

          var popoverTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="popover"]'))
          var popoverList = popoverTriggerList.map(function (popoverTriggerEl) {
            return new bootstrap.Popover(popoverTriggerEl)
          })

    and

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

    Not sure how to rewritethe above to use once?

  • 🇫🇷France erwangel

    #4 worked for me, especially after watching the video (it helps to place the two js lines). Thanks pradipmodh13

Production build 0.71.5 2024