Issue with Bootstrap 5.2 carousel not toggling the visually-hidden class

The hitboxes of the previous and next buttons are visually hidden. Additionally, the indicators at the bottom appear strange, and the sliding animation is not as smooth as expected.

Despite searching extensively and trying various solutions, I am still unsure about the issue. Any assistance in resolving this matter would be greatly appreciated.

h1 {
  text-align: center;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 50px;
}

.row {
  height: 120px;
}

.text-container {
  padding-top: 56px;
}

.c-item {
  height: 500px;
}

.c-image {
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);
}
<!DOCTYPE html>
<html lang="en>

<head>
  <meta charset="UTF-8>
  <meta name="viewport" content="width=device-width, initial-scale=1.0>

  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfbdb0b0abacabadbeaf9febf1ecf1ee">[email protected]</a>/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous>
  <link rel="stylesheet" href="css/stylesheet.css>

  <title>Home>
</head>

<body>

  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c0a2afafb4b3b4b2a1b080f5eef2eef2">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous></script>
  <div>
    <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top>
      <div class="container>
        <a class="navbar-brand mb-0 h1" href="#">Miltons Hotel</a>
        <button type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" class="navbar-toggler" aria-controls="navbarNav" aria-expanded="false" aria-label="toggle-navigation">
            <span class="navbar-toggler-icon"></span>
            Menu
          </button>

        <div class="collapse navbar-collapse" id="navbarNav>
          <ul class="navbar-nav>
            <li class="nav-item active>
              <a href="index.html class="nav-link>Home</a>
            </li>
            <li class="nav-item">
              <a href="Impressum.html class="nav-link">Impressum</a>
            </li>
            <li class="nav-item">
              <a href="Hilfe.html class="nav-link">Help</a>
            </li>
            <li class="nav-item dropdown>
              <a href="#" class="nav-link dropdown-toggle" id="navbarDropdown" data-bs-toggle="dropdown" aria-expanded="false" role="button>
                  Login
                </a>
              <ul class="dropdown-menu" aria-labelledby="navbarDropdown>
                <li>
                  <a href="Loginuser.html" class="dropdown-item>Login</a>
                </li>
                <li>
                  <a href="Registrierung.html class="dropdown-item>Sign Up</a>
                </li>

              </ul>
          </ul>
          <div class="ml-auto></div>
          <form class="d-flex>
            <input type="text" class="form-control me-2>
            <button type="submit" class="btn btn-primary>
                Search
              </button>
          </form>
        </div>
      </div>
    </nav>

    <div id="slider" class="carousel slide text-container" data-bs-ride="carousel>
      <div class="carousel-indicators>
        <button type="button" data-bs-target="#slider" data-bs-slide-to="0 class="active" aria-current="true" aria-label="Slide 1></button>
        <button type="button" data-bs-target="#slider" data-bs-slide-to="1" aria-label="Slide 2></button>
        <button type="button" data-bs-target="#slider" data-bs-slide-to="2" aria-label="Slide 3></button>
      </div>

      <div class="carousel-inner>
        <div class="carousel-item active c-item>
          <img src="img/carousel1.jpg" class="d-block w-100 c-image" alt="Slide 1>
        </div>
        <div class="carousel-item c-item>
          <img src="img/carousel2.jpg" class="d-block w-100 c-image" alt="Slide 2>
        </div>
        <div class="carousel-item c-item>
          <img src="img/carousel3.jpg" class="d-block w-100 c-image" alt="Slide 3>
        </div>
      </div>

      <button class="carousel-control-prev" type="button" data-bs-target="#slider" data-bs-slide="prev>
          <span class="carousel-control-prev-icon" aria-hidden="true></span>
          <span class="visually-hidden">Previous>
        </button>
      <button class="carousel-control-next" type="button" data-bs-target="#slider" data-bs-slide="next>
          <span class="carousel-control-next-icon" aria-hidden="true></span>
          <span class="visually-hidden">Next>
        </button>
    </div>

    <div class="container text-container>
      <div class="row>
        <div class="col-12>
          <h1>Milton Hotels</h1>
        </div>
      </div>
    </div>
  </div>
</body>

</html>

Answer №1

The issue lies in using Bootstrap CSS v4.3.1 alongside Bootstrap JS v5.2.2.

To resolve this, update the Bootstrap CSS version from v4.3.1 to v5.2.2.

Refer to the code snippet below for more details.

h1 {
  text-align: center;
  font-family: Georgia, 'Times New Roman', Times, serif;
  font-size: 50px;
}

.row {
  height: 120px;
}

.text-container {
  padding-top: 56px;
}

.c-item {
  height: 500px;
}

.c-image {
  height: 100%;
  object-fit: cover;
  filter: brightness(0.6);
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">


  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a9cbc6c6dddadddbc8d9e99c879b879b">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">

  <link rel="stylesheet" href="css/stylesheet.css">

  <title>Home</title>
</head>

<body>
  <div>
    <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top">
      <div class="container">
        <a class="navbar-brand mb-0 h1" href="#">Miltons Hotel</a>
        <button type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" class="navbar-toggler" aria-controls="navbarNav" aria-expanded="false" aria-label="toggle-navigation">
            <span class="navbar-toggler-icon"></span>
            Menu
          </button>

        <div class="collapse navbar-collapse" id="navbarNav">
          <ul class="navbar-nav">
            <li class="nav-item active">
              <a href="index.html" class="nav-link">Home</a>
            </li>
            <li class="nav-item ">
              <a href="Impressum.html" class="nav-link">Impressum</a>
            </li>
            <li class="nav-item ">
              <a href="Hilfe.html" class="nav-link">Help</a>
            </li>
            <li class="nav-item dropdown">
              <a href="#" class="nav-link dropdown-toggle" id="navbarDropdown" data-bs-toggle="dropdown" aria-expanded="false" role="button">
                  Login
                </a>
              <ul class="dropdown-menu" aria-labelledby="navbarDropdown">
                <li>
                  <a href="Loginuser.html" class="dropdown-item">Login</a>
                </li>
                <li>
                  <a href="Registrierung.html" class="dropdown-item">Sign Up</a>
                </li>

              </ul>
          </ul>
          <div class="ml-auto"></div>
          <form class="d-flex">
            <input type="text" class="form-control me-2">
            <button type="submit" class="btn btn-primary">
                Search
              </button>
          </form>
        </div>
      </div>
    </nav>

    <div id="slider" class="carousel slide text-container" data-bs-ride="carousel">
      <div class="carousel-indicators">
        <button type="button" data-bs-target="#slider" data-bs-slide-to="0" class="active" aria-current="true" aria-label="Slide 1"></button>
        <button type="button" data-bs-target="#slider" data-bs-slide-to="1" aria-label="Slide 2"></button>
        <button type="button" data-bs-target="#slider" data-bs-slide-to="2" aria-label="Slide 3"></button>
      </div>

      <div class="carousel-inner">
        <div class="carousel-item active c-item">
          <img src="https://static01.nyt.com/images/2021/04/03/multimedia/03xp-april/merlin_185893383_8e41433f-4a32-4b1e-bf02-457290d0d534-superJumbo.jpg" class="d-block w-100 c-image" alt="Slide 1">
        </div>
        <div class="carousel-item c-item">
          <img src="https://static01.nyt.com/images/2021/04/03/multimedia/03xp-april/merlin_185893383_8e41433f-4a32-4b1e-bf02-457290d0d534-superJumbo.jpg" class="d-block w-100 c-image" alt="Slide 2">
        </div>
        <div class="carousel-item c-item">
          <img src="https://static01.nyt.com/images/2021/04/03/multimedia/03xp-april/merlin_185893383_8e41433f-4a32-4b1e-bf02-457290d0d534-superJumbo.jpg" class="d-block w-100 c-image" alt="Slide 3">
        </div>
      </div>

      <button class="carousel-control-prev" type="button" data-bs-target="#slider" data-bs-slide="prev">
          <span class="carousel-control-prev-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Previous</span>
        </button>
      <button class="carousel-control-next" type="button" data-bs-target="#slider" data-bs-slide="next">
          <span class="carousel-control-next-icon" aria-hidden="true"></span>
          <span class="visually-hidden">Next</span>
        </button>
    </div>

    <div class="container text-container">
      <div class="row">
        <div class="col-12">
          <h1>Milton Hotels</h1>
        </div>
      </div>
    </div>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="75171a1a01060107140535405b475b47">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-OERcA2EqjJCMA+/3y+gxIOqMEjwtxJY7qPCqsdltbNJuaOe923+mo//f6V8Qbsw3" crossorigin="anonymous"></script>
</body>
</html>

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

Issue with JavaScript variables (I presume) - there seems to be a conflict when one variable is used alongside another

I am attempting to conduct a test that requires displaying the number of attempts (each time the button is pressed) alongside the percentage of successful attempts, updating each time the button is clicked. However, I've encountered an issue where onl ...

Tips for creating responsive elements with a z-index of 1 in CSS

I have implemented the code provided in a codepen tutorial, but I replaced the world map image with a USA map. However, the dots are not responsive due to the z-index=1 specified on them. I experimented with vh, vw, and percentages, yet when I resize my s ...

Ways to extract variables from a component and utilize them in App.js

Despite my efforts to search online, I could not find the answer or understand what I needed to. My issue: I need the "inputVal" variable from the "InputField.js" component to be accessible in the "App.js" component (specifically in the fetch request where ...

Is there a way to showcase several items simultaneously on a bootstrap 5 carousel slide?

I currently have a bootstrap 5 carousel with controls that I want to modify. My goal is to create a slideshow where each slide displays 2 items, and I can scroll through one image at a time. Starting from here: https://i.sstatic.net/ROgoL.png And ending h ...

I am in need of a JavaScript event that will take precedence over the CSS pointer

There is an image causing issues with scrolling on a mobile device because it's located in the finger-friendly area where people tend to scroll. I attempted to use pointer-events: null; to allow scrolling, but this also prevented the click event from ...

The select tag is malfunctioning in the Firefox browser upon clicking with the mouse

One of the select tags in my application is causing issues in Firefox browser. Although all other select tags in different pages work fine, this particular page seems to be problematic. When attempting to change the option in the select tag, it fails to r ...

Can you please tell me the font size specified as 20px/26px?

Recently stumbled upon the 20px/26px value in a codebase I'm currently working on. Wondering if anyone has encountered this before and knows what its purpose is. Interestingly, it renders with the latter pixel value (26px) in Chrome. #action { font: ...

Expanding div fills remaining space with scrollable content (Utilizing Bootstrap 4 Flexbox grid)

My code was running smoothly before I enabled flexbox support in Bootstrap 4 Alpha 3: Check out the working jsfiddle here However, once flexbox support was enabled, I hit a roadblock. I'm looking for a solution using Bootstrap 4 built-in Flexbox gri ...

Unable to automate the selection of a dropdown menu using Selenium WebDriver

I am currently utilizing http://www.makemytrip.com/ This is the HTML code. <div class="mrgnBot30 clearFix"> <span class="watch_icn flL"></span> <div class="widget_inner clearFix suggest_me padBot15 flL"> <h3 class="clearFix has ...

Dynamic content that adjusts based on a multi-row element

I'm currently designing a webpage layout with a calendar on one side and a series of information-divs on the other. In desktop view, I want the calendar to span three rows like so: CAL DIV1 CAL DIV2 CAL DIV3 Right now, I am achieving this using neste ...

I am having issues with my search form - it doesn't appear to be

I am trying to create a search form that will display users (username, firstname, or lastname) from my database as the user types, similar to how Facebook and Twitter do it. However, when I click on the search button, nothing happens. Below are two parts o ...

What are the steps to create a custom progress bar using JavaScript?

I have experience with HTML and CSS. Below is the HTML code: <div id="wrapper"> <ul id="top"> <center><li><a href="#one" class="button">GENERATE</a></li></center> </ul> <div class="box" i ...

Adjust the CSS for the "a" tag's "title" attribute

I am using jquery.fancybox to create an image modal on my website. I have noticed that I can add a description using the title attribute. However, when the description is too long, the text is displayed on a single line and some of it disappears. How can ...

I am having difficulty accessing specific data in JSON using Searchkit's RefinementListFilter

Utilizing searchkit for a website, I am encountering issues accessing previously converted data in json format. The structure of my json directory is as follows: (...) hits: 0: _index: content _type: content _source: ...

I am unable to retrieve images using the querySelector method

Trying to target all images using JavaScript, here is the code: HTML : <div class="container"> <img src="Coca.jpg" class="imgg"> <img src="Water.jpg" class="imgg"> <img src="Tree.jpg" class="imgg"> <img src="Alien.jpg" class=" ...

I am facing difficulty in incorporating an IP address or URL within an IFRAME in my Cordova Android application

This page does not allow any iframes to load except for the YouTube video URL. When attempting to use any other iframe URL, the following error code is displayed: Error : net::ERR_BLOCKED_BY_RESPONSE In the example below, any URL or IP address fails to l ...

What is the process for updating the background color of the header in ngx datatable?

I am looking to change the background color of the table header to blue. This is the HTML code I have: <ngx-datatable class="material" [rows]="rows" [columnMode]="'force'" [headerHeight]="50" [footerHe ...

Ways to conceal the label without using JavaScript when focusing

I am trying to find a way to hide the label "phone number" when the input is in focus by simply clicking on it. I have attempted using CSS but I need a more effective solution. Please let me know if you can help. <div class="form-row"> ...

Transferring the value stored in the value attribute to a different PHP page?

I am attempting to pass the value from the value attribute in button using a form with the method POST to "landlord_home.php". However, when I click on the button to navigate to the next page "edit_post.php", it triggers the PHP validation code on that pag ...

Divide HTML content while keeping inner tags intact

Currently, I am developing an online store. In my code, there is a requirement to display attributes and descriptions for multiple products on a single page. The attributes are displayed in a table format, while the description can include simple text as w ...