(编辑:jimmy 日期: 2025/10/28 浏览:2)
本文实例为大家分享了jquery插件实现轮播图的具体代码,供大家参考,具体内容如下
轮播图的实现(jquery插件)
需要引入jquery插件,去jquery官网搜索
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
img {
display: block;
}
.slider {
height: 340px;
width: 790px;
margin: 100px auto;
position: relative;
overflow: hidden;
}
.slider li {
position: absolute;
display: none;
}
.slider li:first-child {
display: block;
}
/*文字部分的样式*/
.slider li p {
position: absolute;
width: 100%;
padding: 10px 0;
text-indent: 2em;
background-color: rgba(0, 0, 0, .6);
bottom: 0;
left: 0;
font-size: 18px;
/*给文字设置位移到底部去*/
transform: translate3d(0, 100%, 0);
/*添加过渡*/
transition: all .8s;
}
/*当前展示li 下的文字样式*/
.slider li.current p {
/*文字位移到0的位置,正常显示*/
transform: translate3d(0, 0, 0);
}
.slider li a {
color: #fff;
}
.arrow {
display: none;
}
.slider:hover .arrow {
display: block;
}
.arrow-left,
.arrow-right {
font-family: "SimSun", "宋体";
width: 30px;
height: 60px;
background-color: rgba(0, 0, 0, 0.1);
position: absolute;
top: 50%;
margin-top: -30px;
cursor: pointer;
text-align: center;
line-height: 60px;
color: #fff;
font-weight: 700;
font-size: 30px;
}
.arrow-left:hover,
.arrow-right:hover {
background-color: rgba(0, 0, 0, .5);
}
.arrow-left {
left: 0;
}
.arrow-right {
right: 0;
}
</style>
</head>
<body>
<div class="slider">
<ul>
<li>
<a href="#" >
<img src="/UploadFiles/2021-04-02/1.jpg">
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。