


js css implements super simple secondary drop-down menu effect code_javascript skills
The example in this article describes the implementation of ultra-concise secondary drop-down menu effect code using js css. Share it with everyone for your reference. The details are as follows:
This is a very concise CSS JavaScript secondary menu. It does not use too many modification materials and tries not to use external images. It is concise and elegant, and it is easy for secondary development and improvement. It was originally a menu on a government website.
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/js-css-simple-2jxl-menu-style-codes/
The specific code is as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>二级下拉菜单</title> <style type="text/css"> /* #193B5F 栏目字体颜色 */ *{margin:0; padding:0} body{width:960px; margin:20px auto; font-size:14px;} /*导航条*/ #nav {background-color:blue; color:#fff;height:25px;line-height:25px;text-align:center;list-style:none;} #nav a{color:#fff;} #nav li{width:75px;float:left;position:relative;z-index:1;} #nav li .title{display:block;} #nav li .title:hover{background-color:green;} #nav li .submenu{width:75px;margin:0 auto;background:green;position:absolute;left:0;top:25px;display:none;} #nav li .submenu dd{border-top:1px dotted #ddd;color:#fff;} </style> </head> <body> <ul id="nav"> <!-- 有二级菜单的,给li加class="menu" 没有的不用加 --> <li class="menu"> <a href="#" class="title">国家政务</a> <dl class="submenu"> <dd><a href="#">时政要闻</a></dd> <dd><a href="#">远程党教</a></dd> <dd><a href="#">村务管理</a></dd> </dl> </li> <li> <a href="#" class="title">网络服务</a> </li> <li class="menu"> <a href="#" class="title">信息交流</a> <dl class="submenu"> <dd><a href="#">求购信息</a></dd> <dd><a href="#">转让信息</a></dd> </dl> </li> </div><!--end nav--> <script type="text/javascript"> <!-- var nav = document.getElementById("nav").childNodes; for (var i=0;i<nav.length;i++) { if (nav[i].className=="menu") { nav[i].onmouseover = function(){fnNav(this,"block")}; nav[i].onmouseout = function(){fnNav(this,"none")}; } } function fnNav(obj,flag) { obj.getElementsByTagName("dl")[0].style.display = flag; } //--> </script> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Create a progress bar using HTML5 or CSS: Create a progress bar container. Set the progress bar width. Create internal elements of the progress bar. Sets the internal element width of the progress bar. Use JavaScript, CSS, or progress bar library to display progress.

In HTML, set H5 table borders through CSS: Introduce a CSS style sheet, style the border using border attributes (including border-width, border-style, and border-color sub-properties), and apply the style to the table elements. In addition, specific border styles can be set, such as border-top, border-right, border-bottom, and border-left.

The steps to create an H5 click icon include: preparing a square source image in the image editing software. Add interactivity in the H5 editor and set the click event. Create a hotspot that covers the entire icon. Set the action of click events, such as jumping to the page or triggering animation. Export H5 documents as HTML, CSS, and JavaScript files. Deploy the exported files to a website or other platform.

Running the H5 project requires the following steps: installing necessary tools such as web server, Node.js, development tools, etc. Build a development environment, create project folders, initialize projects, and write code. Start the development server and run the command using the command line. Preview the project in your browser and enter the development server URL. Publish projects, optimize code, deploy projects, and set up web server configuration.

H5 pop-up window creation steps: 1. Determine the triggering method (click, time, exit, scroll); 2. Design content (title, text, action button); 3. Set style (size, color, font, background); 4. Implement code (HTML, CSS, JavaScript); 5. Test and deployment.

Solutions to H5 compatibility issues include: using responsive design that allows web pages to adjust layouts according to screen size. Use cross-browser testing tools to test compatibility before release. Use Polyfill to provide support for new APIs for older browsers. Follow web standards and use effective code and best practices. Use CSS preprocessors to simplify CSS code and improve readability. Optimize images, reduce web page size and speed up loading. Enable HTTPS to ensure the security of the website.

The Create H5 drop-down menu includes the following steps: Create a drop-down list, apply a CSS style, add toggle effects, and handle user selections. The specific steps are as follows: Use HTML to create a drop-down list. Use CSS to adjust the appearance of the drop-down menu. Use JavaScript or CSS to achieve the switching effect. Listen to change events to handle user selections.

There are two ways to make an H5 progress bar: using HTML progress bar elements and using JavaScript to create a progress bar. The HTML progress bar element method involves creating a progress bar element and setting its maximum and current value, while the JavaScript method includes creating a progress bar container and a function that updates the progress bar.
