Tips for setting up a sub-menu upon clicking the menu in the Magister Bootstrap theme

I recently implemented the bootstrap theme Magister, but I am struggling to add a sub-menu to the menu dropdown upon clicking on the menu. Can someone please take a look and provide some advice on where I might be going wrong?

.mainmenu .dropdown-menu {
top: -14em;
left: 0px;
font-size: 13px;
padding:0;
background:none;
border:0 none;
border-radius: 2px;
-webkit-box-shadow: none;
box-shadow: none;
display:block;
opacity:0;
-webkit-transition: all .45s;
   -moz-transition: all .45s;
        transition: all .45s;
}
.mainmenu .dropdown-menu .active { 
font-weight:bold;
}
.mainmenu .open .dropdown-menu { 
top:2px;
opacity:1;
}
.mainmenu .dropdown-menu a { 
padding:10px 10px;
margin:0;
color:white;
text-decoration: none;
-webkit-border-radius: 2px;
   -moz-border-radius: 2px;
        border-radius: 2px;
}
.mainmenu .dropdown-menu a:hover { 
background:rgba(255,255,255,.1);
color:white;
padding:10px 8px 10px 12px;
}
.mainmenu .dropdown-menu ul li ul a{
list-style:none;
background:red;
padding:0;
margin:0;
}
.mainmenu .dropdown-menu ul li ul a:hover{
color:blue;
}
<ul class="dropdown-menu" >
  <li><a href="#">link</a></li>
  <li><a href="#">submenu</a></li>
  <ul>
    <li><a href="#">submenu 1 link</a></li>
<li><a href="#">submenu 2 link</a></li>
<ul>
  <li><a href="#">submenu 2-1 link</a></li>
  <li><a href="#">submenu 2-2 link</a></li>
</ul>
<li><a href="#">submenu 3 link</a></li>
  </ul>
  <li><a href="#">link</a></li>
  <li><a href="#">link</a></li>
</ul>

Answer №1

This method allows you to create a dropdown menu with a collapsible navigation theme provided in the link.

<body>
<div class="container">
<h2>Dropdowns</h2>
<p>The .dropdown class is used to indicate a dropdown menu.</p>
<p>Use the .dropdown-menu class to actually build the dropdown menu.</p>                                          
<div class="dropdown">
<button class="btn btn-default dropdown-toggle" type="button" id="menu1" data-toggle="dropdown">Tutorials
<span class="caret"></span></button>
<ul class="dropdown-menu" role="menu" aria-labelledby="menu1">
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">HTML</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">CSS</a></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">JavaScript</a></li>
<li role="presentation" class="divider"></li>
<li role="presentation"><a role="menuitem" tabindex="-1" href="#">About Us</a></li>
</ul>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"> </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

Disable the outer div scrolling in VueJS, but re-enable it once the inner div has reached the bottom of

I am currently working on a webpage that contains multiple divs stacked vertically. Here is the concept I am working with: Once the scrollbar reaches the bottom of the first div, the outer scrollbar will be disabled and the inner scrollbar will be enabled ...

Maintaining the footer and bottom section of the webpage

I am facing an issue with the footer on my website . I want the footer to always stay at the bottom of the page, even when I dynamically inject HTML code using JavaScript. The footer displays correctly on the main page , but it does not work as intended on ...

Challenges encountered with form submissions on my Next.js 14 project hosted on Netlify

I am struggling to integrate Netlify's form submission feature with my Next.js 14 project. I have followed all of Netlify's guidelines, activated form submissions in the Netlify dashboard, and set up a hidden form in the public folder. Here is wh ...

The animation fails to function, both when hovering over and when not

ul { display: flex; flex-direction: row; align-items: center; list-style-type: none; background-color: $base-gray-t; margin: 1em; padding: .25em 0 0 0; height: 3em; border-bottom: 0.375em solid $secondary-color; overflow: hidden; ...

Direct attention to the modal display

I'm having trouble auto-focusing an input field when a modal is displayed. Here's what I've tried, but it doesn't seem to be working: jQuery(document).ready(function($) { $('#myModal').on('show.bs.modal', functi ...

A Python CGI script that is able to accept and process data submitted

I have been working on a python program to gather data from an HTML form. Here is the snippet of my HTML code: <html> <head> <title> NBA Survey! </title></head> <form method = "POST" action = "result.py"> <hr> Who ...

Button for Processing PayPal Payments

Is there a security risk in using a text button to submit a payment form in PayPal Payments Standard instead of an image button like this: <input type="image" src="http://www.paypal.com/en_US/i/btn/btn_cart_LG.gif" border="0" name="submit" alt=""> ...

Adding ids dynamically to href elements in Vue.js

As a newcomer, I am facing an issue with dynamically adding an id to my href tag. Below is the code snippet: <div class="col-md-6" v-for="Product in data"> <div class="panel panel-default" > <div class="panel-heading"> ...

Guidelines for creating a basic CSS modal

I am working on creating simple modal divs: <div class="modal"></div> <div class="modal-content"></div> Here are the related CSS rules: .modal{position:fixed;background:#444;opacity:0.5;width:100%;height:100%;left:0;right:0;botto ...

Position the dropdown items of the navbar side by side

I am currently struggling to align my Bootstrap 4 dropdown items side by side as shown below: https://i.sstatic.net/i3pP0.png The desired layout involves having Item 1 and Item 2 as dropdown options when hovering over the first Test item. I attempted to ...

Sending an argument to a script's function

As a newcomer in this field, I appreciate your patience. Despite my efforts to find a solution to my problem, I have come up empty-handed. Below is the code in question: In the head <script> function ledonoff(led) { if (document.getElem ...

Is it possible to incorporate a <div> element within a PHP code?

After successfully writing some PHP/SQL code, I encountered an issue when trying to create a new div called "content" along with applying a CSS class. The recommended approach was suggested as follows: $mydiv = '<div name="content">'; $myn ...

What is the process for extracting the sessionId and viewstate variables from this code?

This Question Might Have Been Asked Before: Find the HREF Attribute of an A Element I'm struggling with extracting the sessionId and viewstate variables from this piece of code. Can someone assist me? The code snippet in question is as follows: ...

Updating label content in views.py or alternate methods in Django

class SchoolUpdateView(UpdateView): model = models.School fields = ('name', 'principal') labels = {'name': '學校名稱:', 'principal': '學校校長', 'location': ' ...

Encountered an issue when attempting to create a form using Node.js, Express, and MySQL: "Cannot

While working on a form to collect user data, I encountered an issue after submitting the form where it displayed Cannot POST /users/create. I tried troubleshooting but couldn't find a solution. app.js file- const express = require('express&apos ...

Displaying information from a Node.js server on a React frontend

I have a question about building a simple REST API with Node.js and fetching mock data to render in React. Here is my progress so far: Node.js: const Joi = require("@hapi/joi"); const express = require("express"); const cors = require("cors"); const app ...

Click here to navigate to the anchor and expand the accordion

Is there a way to open an accordion panel using an external anchor link? I attempted to use an anchor link, but it only loads the page without opening the panel. My goal is to have the page load, scroll to the panel, and then open the accordion when the ...

Storing user input from HTML forms in a MySQL database table with PDO

Currently, I am in the process of developing a webpage that will contain multiple forms for users to fill out and submit. Once submitted, PHP will be responsible for executing a query to insert all the data into the table within their respective fields. I ...

What is the best way to position a title at the bottom center of each image within my grid gallery?

I'm struggling to find a way to position a title at the bottom of each image in my grid gallery, right in the center of the photo with a light-gray background. I want the text to be fully visible regardless of the image used. Currently, I can only put ...

When using Angular, the onSelectionChange event is not triggered for angular mat-option components

I am working with a mat-form-field that includes both an input field and a mat-autocomplete feature with mat-options. The input field has a (blur) event triggered when it loses focus, while the mat-option has an (onSelectionChange) event triggered when an ...