


JS CSS implements simple and practical sliding door menu effect_javascript skills
The example in this article describes how to implement a simple and practical sliding door menu effect using JS CSS. Share it with everyone for your reference. The details are as follows:
This is a simple and practical CSS JavaScript sliding door navigation menu. When writing, I tried to use the least code to write code with good compatibility. I hope everyone can like this sliding door, and I also hope that experts who study JS can join me. Learn from each other and improve together.
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-useful-menu-codes/
The specific code is as follows:
<html> <head> <title>简易实用,滑动门</title> <meta http-equiv="Content-Type" content="text/html; charset=gbk" /> <style type="text/css"> *{margin:0;padding:0;} a:link,a:visited{text-decoration:none;} a:hover{text-decoration:none;} ul{list-style:none;} .subMenu{background:#333;float:left;padding-top:2px;width:100%;} .subMenu li{float:left;} .subMenu li a{display:block;float:left;color:#fff;height:25px;line-height:25px;padding:0 5px;margin-left:2px;} .subMenu .thisStyle a {background:#fff;color:#000;} .subContent{clear:both;border:2px solid #000;border-top:none;background:#fff;} .subContent ul{display:none;padding:15px;line-height:180%;} </style> </head> <body> <ul class="subMenu"> <li class="thisStyle"><a href="javascript:void(0)">目录</a></li> <li><a href="javascript:void(0)">列表</a></li> <li><a href="javascript:void(0)">产品</a></li> <li><a href="javascript:void(0)">新网</a></li> </ul> <div class="subContent"> <ul style="display:block;"> <li><a href="#">111111</a></li> <li><a href="#">111111</a></li> <li><a href="#">111111</a></li> <li><a href="#">111111</a></li> </ul> <ul> <li><a href="#">222222</a></li> <li><a href="#">222222</a></li> <li><a href="#">222222</a></li> <li><a href="#">222222</a></li> </ul> <ul> <li><a href="#">333333</a></li> <li><a href="#">333333</a></li> <li><a href="#">333333</a></li> <li><a href="#">333333</a></li> </ul> <ul> <li><a href="#">444444</a></li> <li><a href="#">444444</a></li> <li><a href="#">444444</a></li> <li><a href="#">444444</a></li> </ul> </div> <script> function $_class(name){ var elements = document.getElementsByTagName("*"); for(s=0;s<elements.length;s++){ if(elements[s].className==name){ return elements[s]; } } } //tab effects var tabList = $_class("subMenu").getElementsByTagName("li") tabCon = $_class("subContent").getElementsByTagName("ul"); for(i=0;i<tabList.length;i++){ (function(){ var t = i; tabList[t].onmouseover = function(){ for(o=0;o<tabCon.length;o++){ tabCon[o].style.display = "none"; tabList[o].className = ""; if(t==o){ this.className = "thisStyle"; tabCon[o].style.display = "block"; } } } })() } </script> </bdoy> </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



How to use the Bootstrap button? Introduce Bootstrap CSS to create button elements and add Bootstrap button class to add button text

To adjust the size of elements in Bootstrap, you can use the dimension class, which includes: adjusting width: .col-, .w-, .mw-adjust height: .h-, .min-h-, .max-h-

There are several ways to insert images in Bootstrap: insert images directly, using the HTML img tag. With the Bootstrap image component, you can provide responsive images and more styles. Set the image size, use the img-fluid class to make the image adaptable. Set the border, using the img-bordered class. Set the rounded corners and use the img-rounded class. Set the shadow, use the shadow class. Resize and position the image, using CSS style. Using the background image, use the background-image CSS property.

The file upload function can be implemented through Bootstrap. The steps are as follows: introduce Bootstrap CSS and JavaScript files; create file input fields; create file upload buttons; handle file uploads (using FormData to collect data and then send to the server); custom style (optional).

To verify dates in Bootstrap, follow these steps: Introduce the required scripts and styles; initialize the date selector component; set the data-bv-date attribute to enable verification; configure verification rules (such as date formats, error messages, etc.); integrate the Bootstrap verification framework and automatically verify date input when form is submitted.

To set up the Bootstrap framework, you need to follow these steps: 1. Reference the Bootstrap file via CDN; 2. Download and host the file on your own server; 3. Include the Bootstrap file in HTML; 4. Compile Sass/Less as needed; 5. Import a custom file (optional). Once setup is complete, you can use Bootstrap's grid systems, components, and styles to create responsive websites and applications.

The default style of the Bootstrap list can be removed with CSS override. Use more specific CSS rules and selectors, follow the "proximity principle" and "weight principle", overriding the Bootstrap default style. To avoid style conflicts, more targeted selectors can be used. If the override is unsuccessful, adjust the weight of the custom CSS. At the same time, pay attention to performance optimization, avoid overuse of !important, and write concise and efficient CSS code.

Bootstrap provides a simple guide to setting up navigation bars: Introducing the Bootstrap library to create navigation bar containers Add brand identity Create navigation links Add other elements (optional) Adjust styles (optional)
