当前位置:网站首页>Accordion effect
Accordion effect
2022-07-23 11:56:00 【Zhou million】
Effect display :

html part :
<body>
<div class="container">
<ul>
<li>
<a href="#">
<img src="images/1.jpg" alt="" class="small">
<img src="images/1.jpg" alt="" class="big">
</a>
</li>
<li>
<a href="#">
<img src="images/2.jpg" alt="" class="small">
<img src="images/2.jpg" alt="" class="big">
</a>
</li>
<li>
<a href="#">
<img src="images/3.jpg" alt="" class="small">
<img src="images/3.jpg" alt="" class="big">
</a>
</li>
<li>
<a href="#">
<img src="images/4.jpg" alt="" class="small">
<img src="images/4.jpg" alt="" class="big">
</a>
</li>
<li>
<a href="#">
<img src="images/5.jpg" alt="" class="small">
<img src="images/5.jpg" alt="" class="big">
</a>
</li>
<li>
<a href="#">
<img src="images/6.jpg" alt="" class="small">
<img src="images/6.jpg" alt="" class="big">
</a>
</li>
</ul>
</div>
</body>css part :
<style>
* {
margin: 0;
padding: 0;
}
div {
box-sizing: border-box;
}
.container {
border-radius: 10px;
width: 490px;
height: 90px;
background-color: #eeeddd;
margin: 0 auto;
padding: 10px;
}
ul {
width: 700px;
}
ul li {
overflow: hidden;
position: relative;
list-style: none;
float: left;
width: 70px;
height: 70px;
margin-right: 10px;
}
ul li .small {
position: absolute;
top: 0;
left: 0;
width: 69px;
height: 69px;
border-radius: 5px;
}
ul li .big {
width: 224px;
display: none;
}
</style>JQuery part :
<script src="jquery.min.js"></script>
<script>
$(function() {
// When the mouse moves to ul Inside li Last time ,// li My brothers became 69px, Small pictures fade in , Big pictures fade out ( It's similar to exclusive thought )
$('ul li').mouseenter(function() {
// When the mouse enters '.container', Let his own width become 700px
$('.container').stop().animate({
width: 650
}, 1000);
// use animate() Method , Will the current li Change the width of to 224px
$(this).stop().animate({
width: 224
// Let small pictures '.small' Fade out , Big picture '.big' Fade in ,
}, 1000).find('.small').stop().fadeOut(1000).siblings('.big').stop().fadeIn(1000);
// At the same time, carry out an exclusive thought , Give Way li My brother has become a standard state ( It's similar to exclusive thought )
$(this).siblings().stop().animate({
width: 69
}, 1000).find('.small').stop().fadeIn(1000).siblings('.big').stop().fadeOut(1000);
// When the mouse goes away .container The box , be-all li All become standard});
$('.container').mouseleave(function() {
// When you leave, let '.container' Return to the original size
$('.container').stop().animate({
width: 490
}, 1000);
$('ul li').stop().animate({
width: 69
}, 1000).find('.small').stop().fadeIn(1000).siblings('.big').stop().fadeOut(1000);
})
})
</script>
边栏推荐
- 求1~100之间不能被3整除的数之和
- Mosaic the face part of the picture
- 数仓4.0笔记——用户行为数据采集四
- 八、集合框架和泛型
- Software test 1
- 使用makefile编译ninja
- Adding environment variables and templates to systemctl service
- MySQL backup
- NFT digital collection system development: Shenzhen Evening News "good times travel" digital collection online seconds chime
- Shell takes the month within a certain time range
猜你喜欢
![[untitled]](/img/c6/735dec4022d7fed8a62b5df45df17b.png)
[untitled]

Introduction to the process structure used by activiti workflow

Using cluster analysis to build a credit card high-risk customer identification model

Installation and process creation of activiti app used by activiti workflow

MySQL password free login settings

Data warehouse 4.0 notes - user behavior data collection IV
![[system problems] Net Framework 3.5 installation error](/img/a1/f5410e954b607d5c0549051bd68aa1.png)
[system problems] Net Framework 3.5 installation error

NFT digital collection platform development and construction, source code development digital collection

八、集合框架和泛型

高德定位---权限弹框不出现的问题
随机推荐
九、实用类
[metric] use Prometheus to monitor flink1.13org.apache.flink.metrics
Machine learning algorithm for large factory interview (5) recommendation system algorithm
[untitled]
SQL realizes the user statistics of continuous login for more than 7 days
3. DQL (data query statement)
修改mysql的root密码
循环队列
MySQL password free login settings
Data warehouse 4.0 notes - business data collection
3.1. Simplified supplement to DQL
1. Know the database
[untitled]
使用makefile编译ninja
[system problems] Net Framework 3.5 installation error
Ten year structure five year Life-02 first job
Data warehouse 4.0 notes - business data collection - sqoop
ADB common commands
Scala II process control
3、DQL(数据查询语句)