时间:2021-07-01 10:21:17 帮助过:3人阅读
CSS
*{
border:none;
margin: 0;
padding: 0;
list-style: none;
outline: none;
}
html,body{
width: 100%;
height: 100%;
}
/*方法二*/
body{
display: flex;
align-items: center;/****水平居中****/
justify-content: center;/*垂直居中*/
}
.parent{
width: 750px;
height: 400px;
/*方法一*/
/*margin: 0 auto;*/
/*position: relative;*/
/*top: 50%;*/
/*margin-top: -200px;*/
}
/*轮播*/
.top p{
width: 90%;
margin: 0 auto;
}
.top p a{
display: inline-block;
line-height: 30px;
width: 23%;
padding: 10px 0;
text-align: center;
text-decoration: none;
border: 2px solid transparent;
color: slategray;
}
.top p a.selected{
border: 2px solid #e4393c;
color: #e4393c;
}
/*图片*/
.fours{
width: 650px;
margin: 0 auto;
height: 300px;
position: relative;
margin-top: 30px;
}
.fours a{
position: absolute;
}
JS
定义变量和定时器,变量等价于eq(index)中index,自动轮播是可以的,关键在于,鼠标进入选项卡区域时候,怎么对应想要的轮播画面,
方法:停止定时器,获取当前选项卡下标,匹配对应的轮播画面显示出来。
以上这篇jQuery实现选项联动轮播效果【附实例】就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。