原生原生js实现简单的焦点图效果实例实现简单的焦点图效果实例
下面小编就为大家分享一篇原生js实现简单的焦点图效果实例,具有很好的参考价值,希望对大家有所帮助。一
起跟随小编过来看看吧
用到一些封装好的运动函数,主要是定时器
效果为图片和图片的描述定时自动更换。效果为图片和图片的描述定时自动更换。
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
ul,
li,
p,
h3 {
padding: 0;
margin: 0;
list-style: none;
}
img {
border: none;
vertical-align: top;
}
#bg_box {
width: 1000px;
height: 590px;
margin: 50px auto;
position: relative;
background: url(img/bg1.jpg) no-repeat;
}
.pic {
width: 440px;
height: 274px;
position: absolute;
top: 50px;
left: 220px;
overflow: hidden;
}
.li_box {
width: 1760px;
height: 274px;
position: absolute;
left: 0;
}
.tags {
width: 440px;
height: 80px;
position: absolute;
bottom: -80px;
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
color: white;
padding-left: 20px;
padding-top: 15px;
box-sizing: border-box;
}
.tags:nth-of-type(1) {
/*bottom: 0;*/
}
.img {
float: left;
width: 440px;
height: 274px;
}
h3 {
font: bold 20px/30px "微软雅黑";
}