Home > Web Front-end > JS Tutorial > Implementation of drop-down menu under Bootstrap framework (code example)

Implementation of drop-down menu under Bootstrap framework (code example)

不言
Release: 2018-10-15 16:52:35
forward
6595 people have browsed it

The content this article brings to you is about the implementation of drop-down menus under the Bootstrap framework (code examples). It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Context menus or hidden/show menu items are often needed when interacting with web pages. Bootstrap provides a switchable, contextual menu by default for displaying a link list. Moreover, the menu display in various interactive states needs to be used in conjunction with the javascript plug-in. This article will introduce the Bootstrap drop-down menu in detail (free course recommendation: bootstrap tutorial)

Usage method

When using the drop-down menu of the Bootstrap framework, The bootstrap.js file provided by the Bootstrap framework must be called. Of course, if you are using the uncompiled version, you can find a file named "dropdown.js" in the js folder, and you can also call this js file

because Bootstrap's component interaction effects all depend on A plug-in written by the jQuery library, so jquery.js must be loaded before using bootstrap.js to produce the effect

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</body>
</html>
Copy after login

Basic usage

When using the drop-down menu component in the Bootstrap framework, it is very important to use the correct structure. If the structure and class name are not used correctly, it will directly affect whether the component can be used normally.

1. Use a name The "dropdown" container wraps the entire drop-down menu element

<div class="dropdown"></div>
Copy after login

2. Use a

Related labels:
source:cnblogs.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template