Clicking on the breadcrumb separator

My objective is to present hierarchical data using the bootstrap breadcrumb component. Specifically, upon clicking the separator symbol >, I aim to showcase a dropdown list containing the siblings - akin to the interface in Windows Explorer when navigating through folders within a directory structure. Upon clicking the arrow adjacent to 'Internet Explorer,' we can observe the subsequent subfolders.

https://i.sstatic.net/93rYG.png

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="#">Parent</a></li>
    <li class="breadcrumb-item"><a href="#">Item1</a></li>
    <li class="breadcrumb-item active" aria-current="page">Subitem1</li>
  </ol>
</nav>

In the context of the breadcrumb trail formed by Parent > Item1 > Subitem1, my intention is to enable a dropdown feature when selecting the separator positioned between Parent and Item1. This dropdown should present options such as Item1 (active), Item2, and Item3.

Parent
   Item1
     Subitem1
     Subitem2
   Item2
   Item3

I am seeking guidance on how to implement the dropdown functionality within the separator element.

Answer №1

To achieve a clickable separation for breadcrumbs, you cannot rely on the built-in CSS ::before pseudo-element alone. You need to implement them using HTML elements.

All you have to do is incorporate a dropdown as the separator. For detailed instructions, you can refer to the documentation: https://getbootstrap.com/docs/4.5/components/dropdowns/

.breadcrumb-item + .breadcrumb-item::before {
    display: none !important;
}

.breadcrumb .dropdown.show .arrow {
  transform: rotate(90deg);
  text-decoration: none;
}
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>

<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="#">Parent</a> > </li>
    <li class="breadcrumb-item">
      <a href="#">Item1</a>
      <div class="dropdown d-inline">
        <a class="d-inline-block arrow" href="javascript:" data-toggle="dropdown">
          >
        </a>
        <div class="dropdown-menu">
          <a class="dropdown-item" href="#">Item1</a>
          <a class="dropdown-item" href="#">Item2</a>
          <a class="dropdown-item" href="#">Item3</a>
        </div>
      </div>
    </li>
    <li class="breadcrumb-item active" aria-current="page">Subitem1</li>
  </ol>
</nav>

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

Revolutionizing the small screen design with a dynamic Bootstrap Responsive Layout that seamlessly adjusts to different screen sizes

In the beginning, I constructed a footer using HTML, CSS, and JS. Eventually, I stumbled upon Bootstrap and decided to recreate the footer using Bootstrap, following a mobile-first design approach for screens smaller than 576px. I had previously designed ...

I must update the menu to show only one sub-menu at a time, ensuring that multiple menus cannot be displayed simultaneously

When I click on a menu option, it displays correctly, but when I click on another option, both are displayed. The goal is to only display one at a time. https://i.sstatic.net/J6vLf.png $('.sub-menu ul').hide(); $(".sub-menu a").click( ...

"Stylish hover effect for list items using CSS arrows

I'm struggling with creating a list menu that has a 1px border and spans the entire width. Here is what I have so far (image 1): https://i.stack.imgur.com/y3EDP.png The tricky part is making it so that when the mouse hovers over a menu item, someth ...

"Enhance your design with a cutting-edge gradient button using CSS

While exploring gradient effects in CSS, I stumbled upon this unique button design. After extensive searching on the internet, I couldn't find a solution on how to recreate the same button effect using CSS. Is it possible to create it using CSS?Button ...

When resizing the screen, the contents of the Bootstrap 3 navbar disappear instead of collapsing as intended

I'm currently working on developing a responsive navigation bar that collapses when the screen size is reduced. However, I seem to be encountering an issue where the only visible element after resizing the screen is the header which remains active at ...

Curves are unable to form on borders using the border-radius property

While working on a webpage, I encountered an issue with CSS attributes and table borders. Despite using the border-radius attribute, the border didn't round along with the background; it just stayed at a corner. Below is my code snippet, any help is g ...

Distinguishing appearances among various web browsers

How come the menus look different in Firefox compared to Chrome, Safari, and IE? I've tried adjusting the CSS but can't seem to get it just right. Any suggestions on how to fix this? In Firefox, there's an overlapping part at the bottom of ...

Differences in layout design when using floats and display: table between Chrome and Firefox can affect the visual appearance

Try out this link on JS Fiddle: https://jsfiddle.net/7p81bnto/2/ Here's the HTML code: <body> <main> <div> <div style=" height: 50px; width: 200px; ...

I am seeking for the HTML table to display the outcome depicted in the image

My goal is to achieve the design shown in the image below with my code, but unfortunately it's not giving me the desired result. <form> <table> <tr> <td><label for="Uname">User Name:&l ...

Achieving Equal Height for Two Bootstrap 4 Columns with Scrollbar

I've been searching everywhere for a solution to this problem. My goal is to design a page with a video player on the left side and a chat on the right side. I am using the embed-responsive class for the video player so that it adjusts its size based ...

Generating dynamic div elements in a Laravel blade template using a foreach loop

After receiving an object from the controller to the blade using compact, I am utilizing it in my blade file to display the data. <div class="col-lg-4 col-md-4 col-xs-12 col-sm-6"> <!-- This must regenerate to print next 4 entries--> ...

Selecting a radio button using information retrieved from a JSON source

I am working with a set of radio buttons that send data to the database in the form of 0 and 1 (1=Yes, 0=No). I want to retrieve this information from the database and highlight the appropriate radio button based on the saved value. Here is my code snippet ...

Variations in functionality within the Google Chrome browser

This is the content of my HTML document. <BODY> <button id="b1" onclick="load()">Play</button> <canvas id="c1" onclick="f_clicked(this.id,1)"> Your browser does not support the HTML5 canvas tag. </canvas> ...

What steps should be taken to refresh a page following an AJAX file upload?

I need some help creating a progress bar to track file uploads on my website. Here's what I have so far: HTML: <form action="upload/files.php" method="post" enctype="multipart/form-data" id="frmUpload"> <input type="file" name="upfile" ...

The JavaScript require() function appears to be malfunctioning

Why am I encountering an error when trying to import a valid node_module? <script > var Twit = require('twit'); </script> Error: Uncaught ReferenceError: require is not defined I am puzzled as to why the require() function wor ...

Disable the toggling of the dropdown functionality in the bootstrap function

Recently, I made some modifications to a bootstrap navbar by transforming it into a toolbar and adjusting a dropup dropdown to include two datepicker elements. An issue arose when the dropdown would collapse upon selecting a date. To address this problem, ...

Utilizing Card Images in a Slider with Bootstrap 4

Is there a way to turn the card-image-top section into a slider, especially for mobile use? I want to showcase multiple product images in this section for my customers to see. Any simple solutions for achieving this? <div class="card" style= ...

Exploring creative methods for incorporating images in checkboxes with CSS or potentially JavaScript

Although it may seem like a basic question, I have never encountered this particular task before. My designer is requesting something similar to this design for checkboxes (positioned on the left side with grey for checked boxes and white for unchecked). ...

PhoneGap redirect page feature

When using PhoneGap, I have encountered an issue with opening internal links. Despite using the href tag in my HTML, I am unable to load the webpage. Can someone please advise on how to properly redirect from one HTML page to another within PhoneGap? ...

tips for incorporating staticfiles processing into css files on django

Within my CSS stylesheets, I often have code snippets like the following: #defaultCountdown span.countdown_section { color:#fff; padding:7px 15px!important; margin-bottom:2px; font-weight:300; background:url(../img/bg-white.png); t ...