仿万科底部的新闻滑动特效
2018-06-24 00:07:01来源:未知 阅读 ()
仿万科底部的新闻滑动特效:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>仿万科的底部的新闻滑动特效</title>
<style>
* {
padding: 0;
margin: 0;
}
#subject {
position: relative;
width: 80%;
height: 165px;
background: skyblue;
margin: 200px auto;
overflow: hidden;
}
#subject > ul > li {
position: absolute;
float: left;
list-style: none;
width: 40%;
height: 165px;
font-size: 48px;
text-align: center;
color: #fff;
line-height: 165px;
transition: 0.5s;
}
.item1 {
background: orange;
left: 0;
z-index: 1;
}
/*hover:item1*/
#subject.state-1 .item2,
.item2 {
background: deepskyblue;
left: 40%;
z-index: 2;
}
/*hover:item2*/
#subject.state-4 .item2,
#subject.state-3 .item2,
#subject.state-2 .item2 {
left: 20%;
}
/*hover:item3*/
#subject.state-4 .item3,
#subject.state-3 .item3 {
left: 40%;
}
/*hover:item4*/
#subject.state-4 .item4{
left: 60%;
}
#subject.state-1 .item3,
.item3 {
background: mediumseagreen;
left: 60%;
z-index: 3;
}
#subject.state-3 .item4,
#subject.state-2 .item4,
#subject.state-1 .item4,
.item4 {
background: pink;
left: 80%;
z-index: 4;
}
</style>
</head>
<body>
<div id="subject" class="wrapper">
<ul>
<li class="item item1">1</li>
<li class="item item2">2</li>
<li class="item item3">3</li>
<li class="item item4">4</li>
</ul>
</div>
<script>
$(function () {
$('.item').hover(function () {
if ($(this).hasClass('item1')) {
$('#subject').removeClass().addClass('state-1');
}
if ($(this).hasClass('item2')) {
$('#subject').removeClass().addClass('state-2');
}
if ($(this).hasClass('item3')) {
$('#subject').removeClass().addClass('state-3');
}
if ($(this).hasClass('item4')) {
$('#subject').removeClass().addClass('state-4');
}
});
$('#subject').mouseleave(function () {
$('#subject').removeClass();
});
});
</script>
</body>
</html>
标签:
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有
上一篇:JS笔记:Array方法整理
- pc端vue 滚动到底部翻页 2019-08-14
- ionic 兼容title居中显示和tab栏在显示底部 2019-02-17
- Node.js在指定的图片模板上生成二维码图片并附带底部文字说 2019-01-01
- Vue路由跳转到新页面时 默认在页面最底部 而不是最顶部 的解 2018-09-18
- 如何写一个适配iPhoneX的底部导航 2018-06-24
IDC资讯: 主机资讯 注册资讯 托管资讯 vps资讯 网站建设
网站运营: 建站经验 策划盈利 搜索优化 网站推广 免费资源
网络编程: Asp.Net编程 Asp编程 Php编程 Xml编程 Access Mssql Mysql 其它
服务器技术: Web服务器 Ftp服务器 Mail服务器 Dns服务器 安全防护
软件技巧: 其它软件 Word Excel Powerpoint Ghost Vista QQ空间 QQ FlashGet 迅雷
网页制作: FrontPages Dreamweaver Javascript css photoshop fireworks Flash
