This article shares the specific code of js to achieve the accordion effect for your reference. The specific content is as follows Effect: Implementation code: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title></title> <style> *{ margin:0; padding:0; } ul,li{ list-style:none; } .box{ width:1200px; height:260px; margin:50px auto 0; overflow: hidden; } .list{ width:2000px; height:260px; } .list>li{ width:200px; height:260px; float:left; background-image:url(images/1.jpg); background-position:center center; background-repeat:no-repeat; } .list>li:nth-child(2){ background-image:url(images/2.jpg); } .list>li:nth-child(3){ background-image:url(images/3.jpg); } .list>li:nth-child(4){ background-image:url(images/4.jpg); } .list>li:nth-child(5){ background-image:url(images/5.jpg); } .list>li:nth-child(6){ background-image:url(images/6.jpg); } </style> </head> <body> <div class="box"> <ul class="list"> <li></li> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> </div> <script src="js/startmove.js"></script> <script> var oLis = document.getElementsByClassName("list")[0].children; for(var i = 0; i < oLis.length; i++){ oLis[i].onmouseover = function(){ for(var j = 0; j < oLis.length; j++){ startMove(oLis[j],{ width:160 },50) } startMove(this,{ width:400 },50) } oLis[i].onmouseout = function(){ for(var j = 0; j < oLis.length; j++){ startMove(oLis[j],{ width:200 },10) } } } </script> </body> </html> The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Analysis of the process of deploying pure HTML files in Tomcat and WebLogic
>>: Problems and solutions when installing and using VMware
[LeetCode] 196.Delete Duplicate Emails Write a SQ...
MySQL is a free relational database with a huge u...
The first tutorial for installing MySQL-5.7.19 ve...
I am currently learning MySQL. I am a complete no...
Table of contents 1. Overview 2. Django Project 3...
This article example shares the specific code of ...
A recent business involves such a requirement tha...
Docker Compose is a Docker tool for defining and ...
Get the current date + time (date + time) functio...
Table of contents Intro Nginx Dockerfile New conf...
Adding the rel="nofollow" attribute to ...
Table of contents 1. Introduction to Linux system...
Table of contents 1. Quickly recognize the concep...
Method 1: var a = [1,2,3]; var b=[4,5] a = a.conc...
I searched a lot of articles online but didn'...