jQuery implements accordion effects

jQuery implements accordion effects

This article shares the specific code of jQuery to implement accordion for your reference. The specific content is as follows

Use jQuery effects (functions as follows):

Code (chain programming):

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="../jquery-3.4.1.min.js"></script>
<style type="text/css">
* {
margin: 0;
padding: 0;
}

img {
display: block;
}

ul {
list-style: none;
}

.king {
width: 852px;
margin: 100px auto;
background: url(../images/bg.png) no-repeat;
overflow: hidden;
padding: 10px;
}

.king ul {
overflow: hidden;
}

.king li {
position: relative;
float: left;
width: 69px;
height: 69px;
margin-right: 10px;
}

.king li.current {
width: 224px;
}

.king li.current .big {
display: block;
}

.king li.current .small {
display: none;
}

.big {
width: 224px;
display: none;
}

.small {
position: absolute;
top: 0;
left: 0;
width: 69px;
height: 69px;
border-radius: 5px;
}
</style>
</head>

<body>
<div class="king">
<ul>
<li class="current">
<a href="#" >
<img src="../images/m1.jpg" alt="" class="small">
<img src="../images/m.png" alt="" class="big">
</a>
</li>
<li>
<a href="#" >
<img src="../images/l1.jpg" alt="" class="small">
<img src="../images/l.png" alt="" class="big">
</a>
</li>
<li>
<a href="#" >
<img src="../images/c1.jpg" alt="" class="small">
<img src="../images/c.png" alt="" class="big">
</a>
</li>
<li>
<a href="#" >
<img src="../images/w1.jpg" alt="" class="small">
<img src="../images/w.png" alt="" class="big">
</a>
</li>
<li>
<a href="#" >
<img src="../images/z1.jpg" alt="" class="small">
<img src="../images/z.png" alt="" class="big">
</a>
</li>
<li>
<a href="#" >
<img src="../images/h1.jpg" alt="" class="small">
<img src="../images/h.png" alt="" class="big">
</a>
</li>
<li>
<a href="#" >
<img src="../images/t1.jpg" alt="" class="small">
<img src="../images/t.png" alt="" class="big">
</a>
</li>
</ul>
</div>

</body>
<script>
$(function() {
//1. When the mouse passes over the small li, there are two steps: the width of the current small li becomes 225px, and the small picture inside fades out, and the large picture fades in. //2. The width of the remaining brother elements small li becomes 69px, the small picture fades in, and the large picture fades out. $(".king li").mouseenter(function() {
$(this).stop().animate({
width: 224
}).find(".small").stop().fadeOut().siblings(".big").stop().fadeIn();
$(this).siblings("li").stop().animate({
width: 69
}).find(".small").stop().fadeIn().siblings(".big").stop().fadeOut();
})
})
</script>

</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:
  • jQuery Easyui usage (I) foldable panel layout accordion menu
  • jQuery plugin to create accordion panel effect
  • jQuery makes an awesome accordion menu
  • Simple accordion effect example implemented by jQuery
  • Implementing accordion menu based on Jquery code
  • Make accordion based on slideDown and slideUp of jquery
  • jQuery to achieve accordion effect example code
  • jQuery accordion special effects plugin
  • Jquery component easyUi implements accordion (folding panel) example
  • jQuery to achieve accordion effect

<<:  iview implements dynamic form and custom verification time period overlap

>>:  jQuery realizes the full function of shopping cart

Recommend

Detailed explanation of pure SQL statement method based on JPQL

JPQL stands for Java Persistence Query Language. ...

Brief introduction and usage of Table and div

Web front end 1 Student ID Name gender age 01 Zha...

Use of Linux xargs command

1. Function: xargs can convert the data separated...

mysql8.0.11 winx64 installation and configuration tutorial

The installation tutorial of mysql 8.0.11 winx64 ...

Tutorial on installing Tomcat server under Windows

1 Download and prepare First, we need to download...

This article takes you into the world of js data types and data structures

Table of contents 1. What is dynamic typing? 2. D...

Detailed tutorial on installing Mysql5.7.19 on Centos7 under Linux

1. Download MySQL URL: https://dev.mysql.com/down...

Implementation of Nginx+ModSecurity security module deployment

Table of contents 1. Download 2. Deployment 1.Ngi...

Vue uses Baidu Maps to realize city positioning

This article shares the specific code of Vue usin...

In-depth explanation of MySQL isolation level and locking mechanism

Table of contents Brief description: 1. Four char...

Detailed tutorial on installing JDK1.8 on Linux

1. Cleaning before installation rpm -qa | grep jd...

Add ?v= version number after js or css to prevent browser caching

Copy code The code is as follows: <span style=...

How to run JavaScript in Jupyter Notebook

Later, I also added how to use Jupyter Notebook i...

A mobile adaptive web page effect solves the problem of small display page

For work needs, I need to make a mobile phone adap...

How to purchase and initially build a server

I haven't worked with servers for a while. No...