网站首页 > 知识剖析 正文
知识点:css浮动定位,css3 nth-child()选择器,jQuery animate()动画函数,jQuery stop()函数
效果图:
代码:
html代码:
<div class="img_show">
<ul>
<li></li>
<li></li>
<li></li>
<li></li>
<li></li>
</ul>
</div>
css代码
/* init */
*{
margin:0;
padding:0;
}
ul{
list-style-type: none;
}
/* show */
div.img_show{
width:1000px;
height:300px;
}
div.img_show ul li{
width:100px;
height:300px;
background-repeat: no-repeat;
background-size:100% 100%;
float:left;
}
div.img_show ul li:nth-child(1){
background-image: url(../img/1.jpg);
}
div.img_show ul li:nth-child(2){
background-image: url(../img/2.jpg);
}
div.img_show ul li:nth-child(3){
background-image: url(../img/3.jpg);
}
div.img_show ul li:nth-child(4){
background-image: url(../img/4.jpg);
}
div.img_show ul li:nth-child(5){
background-image: url(../img/5.jpg);
width:400px;
}
javascript代码
$(function(){
$('div.img_show ul li').mouseover(function(){
$(this).stop(true).animate({
width:'400px'
},2000).siblings().stop(true)
.animate({
width:'100px'
},2000)
})
})
声明:图片资源均来自互联网,如有侵权,请联系作者删除
转载说明:转载时,请注明出处,谢谢
jQuery库下载地址:https://www.bootcdn.cn/
猜你喜欢
- 2024-11-21 Chrome:2023年CSS增加了哪些功能?
- 2024-11-21 WEB基础面试题——HTML、CSS
- 2024-11-21 手风琴特效这么飒,你能用 JavaScript 实现吗?
- 2024-11-21 css篇四 文本样式(上)
- 2024-11-21 Python Web全栈之旅12--Web前端●CSS扩展知识点汇总,建议收藏
- 2024-11-21 自己动手打造工具系列之自动刷新简历
- 2024-11-21 web前端:CSS的常用属性速查表
- 2024-11-21 css操作之常用技巧
- 2024-11-21 《锋利的jQuery》观后记
- 2024-11-21 了解CSS Flex:解析实例、用法和案例研究
- 最近发表
- 标签列表
-
- xml (46)
- css animation (57)
- array_slice (60)
- htmlspecialchars (54)
- position: absolute (54)
- datediff函数 (47)
- array_pop (49)
- jsmap (52)
- toggleclass (43)
- console.time (63)
- .sql (41)
- ahref (40)
- js json.parse (59)
- html复选框 (60)
- css 透明 (44)
- css 颜色 (47)
- php replace (41)
- css nth-child (48)
- min-height (40)
- xml schema (44)
- css 最后一个元素 (46)
- location.origin (44)
- table border (49)
- html tr (40)
- video controls (49)