The persistent presence of the Dropup Bootstrap class ensures that it remains active and visible at all

The dropdown-item class functions correctly only when used with the dropdown class, but does not work with the dropup class.
The dropup feature fails to function after clicking on all submenu items. This is because all dropdown-items become active and visible after each click.
Code Snippet and Scenario Images of the issue provided below.

1. First Image: All Submenus Active and Visible

https://i.sstatic.net/LZ5PS.jpg

2. Second Image: Inspect Element

https://i.sstatic.net/9nT37.jpg

<!doctype html>
<html lang="en>
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">

    <title>DropUp bootstrap</title>
  </head>
  <body>
  
<ul class="nav flex-column">

    <li class="nav-item dropdown mb-5">
        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">DropDown</a>
        <div class="dropdown-menu">
            <a class="dropdown-item" data-toggle="tab" href="#hello1">Hello1</a>
            <a class="dropdown-item" data-toggle="tab" href="#hello2">Hello2</a>
            <a class="dropdown-item" data-toggle="tab" href="#hello3">Hello3</a>
        </div>
    </li>

    <li class="nav-item dropup mt-5">
        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">DropUp</a>
        <div class="dropdown-menu">
            <a class="dropdown-item" data-toggle="tab" href="#hello1">Hello1</a>
            <a class="dropdown-item" data-toggle="tab" href="#hello2">Hello2</a>
            <a class="dropdown-item" data-toggle="tab" href="#hello3">Hello3</a>
        </div>
    </li>

</ul> <!-- End nav -->

<div class="tab-content mt-1">

    <div class="tab-pane fade" id="hello1">
      <h1>Hello 1</h1>
    </div> <!-- End hello1 -->

    <div class="tab-pane fade" id="hello2">
      <h1>Hello 2</h1>
    </div> <!-- End hello2 -->

    <div class="tab-pane fade" id="hello3">
      <h1>Hello 3</h1>
    </div> <!-- End hello3 -->

</div> <!-- End tab-content -->


    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
  </body>
</html>

Answer №1

There is a well-documented issue with Bootstrap 4.0.0 that you can find more information about here.

To work around this issue, you can apply both the dropdown and dropup classes to your "dropdown" element.

For a practical example, check out this link:

<li class="nav-item dropdown dropup mt-5">
        <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">DropUp</a>
        <div class="dropdown-menu">
            <a class="dropdown-item" data-toggle="tab" href="#hello1">Hello1</a>
            <a class="dropdown-item" data-toggle="tab" href="#hello2">Hello2</a>
            <a class="dropdown-item" data-toggle="tab" href="#hello3">Hello3</a>
        </div>
</li>

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

Here is a helpful guide on updating dropdown values in real time by retrieving data from an SQL database

This feature allows users to select a package category from a dropdown menu. For example, selecting "Unifi" will display only Unifi packages, while selecting "Streamyx" will show only Streamyx packages. However, if I first select Unifi and then change to S ...

Implementing Github Oauth2 in a Rails server independent from a chrome extension

Looking to implement Github Oauth2 from my chrome extension, but rather than using chrome.identity.launchWebAuthFlow I want to handle it through my server. This way, I can avoid exposing my client ID and Client Secret in the javascript of the extension. My ...

Chrome experiencing stuttering issue with jQuery's .slideUp() function

When I click a button, I want to hide certain elements in my HTML document. $(document).on('mouseup','#button',function() { setTimeout(setupBox1,100); setTimeout(setupBox2,Math.floor((Math.random() * 3000) + 800)); setTimeo ...

Error: Unable to access property 'camera' as it is undefined

After implementing the Raycaster from Three js to detect collision following a MouseMove event, I encountered an error: Cannot read properties of undefined (reading 'camera') Here is the code snippet causing the issue: bindIFrameMousemove(if ...

Is Joi's existence a myth?

I've been using Joi for validation, and I've encountered a situation that I'm having trouble with. I have an object that sometimes includes an id field (for editing) and other times it doesn't (for creating). My goal is to validate tha ...

Vertical alignment using Bootstrap buttons for pull-up and pull-down functionality

My design includes a row of Bootstrap buttons displayed horizontally. These buttons come in two sizes - medium and small, with the requirement that two small buttons should occupy the same vertical space as one medium button when stacked vertically. To il ...

What is the process for transferring npm package files to my local project?

Despite my efforts to find the answer, I couldn't locate it and so here I am asking again. What I'm looking for: I need to move a file from node_modules to my project in order to work on it. First attempt: I moved the file I wanted to edit An ...

Remove the initial 15,000 lines from a text file using Node.js

Looking for a way to delete the first 15,000 lines of a large text log file (roughly 20MB) using Node.js. Any suggestions on how to accomplish this task? ...

Verify the presence of an image

I have a code snippet that I use to refresh an image in the browser. However, I want to enhance this code so that it first checks if the image exists before displaying it. If the image does not exist, I want to display the previous version of the picture i ...

Tips on how to round a whole number to the closest hundred using Javascript

Suppose there is a numerical value given let x = 890 and the objective is to round it off to 900. If the number is 820, then it should be rounded to 800. We can safely assume that the input number (x) will always be an integer. While manually checking ...

Searching in Javascript: Extracting an "ID" from a given string using regular expressions

I am trying to work with the following string: comment_1234 My goal is to extract the number 1234 from this string. How can I achieve this? Update: Despite attempting various solutions provided, none seem to be working for me. Could there be an issue wit ...

Loading JavaScript variable with pre-processed JavaScript information

I have been working on loading test data into a javascript object and then passing it to my heating timers. While I have managed to make it work by individually inserting the code into each timer, I am looking to optimize my code and enhance my understandi ...

Understanding text overflow in JavaScript and jQuery

I am facing an issue where the text in some columns of my table is breaking into two lines. I believe reducing the font size will resolve this problem, but I am unsure about where to start coding for this particular issue. If you have any ideas or sugges ...

Modify the MUI time picker to display as a digital clock inside a DateTimePicker widget

I need to update my MUI DateTimePicker component to use the DigitalClock time picker instead of the Analog Clock picker. The current component has two steps, first picking the date from a calendar and then selecting the time. This change is only necessary ...

Display a PDF on a website and ensure it is horizontally scrolled to the center

After embedding a PDF in a webpage, I noticed that the width of the window is smaller than the actual PDF, resulting in a horizontal scroll bar appearing. Surprisingly, the PDF itself has wide margins on both sides, making it challenging for users to view ...

What is the best way to display pages with different states in ExpressJS?

Here is a code block that I have: var express = require('express'); var newsRouter = express.Router(); newsRouter.get('/:news_param', (req, res) => { let news_params = '/haberler/' + req.params.news_param; req.ne ...

resizing a big image to perfectly fit the width of the screen with the help of

Is there a way to use AngularJS to automatically adjust the size of a large image to fit the screen on various devices (responsive), similar to how it is done on this website? Are there any Angular directives available for this purpose, or would I need to ...

The $multiply function is only compatible with numerical data types, not arrays

Attempting to utilize the $multiply operator within MongoDB. STEP 1 db.message1064sd_00011_3744.aggregate([ {$project : { "prices.00026" : 1, priceReal : { price : "$prices.00026", } }}, { $match : { ...

User currently signed in: What specific information should be transmitted to the web browser?

Experience: Currently utilizing the MEAN stack for a web application and still in the learning process. The Concern: I am facing some confusion regarding a particular aspect. For instance, if a user is logged in (using Passport.js), I can access their inf ...

In Angular and Sublime Text 2, I'm having an issue where one file is working perfectly while the other one isn't. I've closely examined both

As I follow along with the angularjs tutorial, I am attempting to replicate each step. In the section on routes, we are instructed to create a file called app.js. I am using SublimeText2 as my text editor, with both syntax settings set to javascript. Surpr ...