实现轮播图效果

该文档实现的效果如下:

    1. 轮播图获得焦点时,显示左右箭头,并停止轮播图自动播放

    2. 实现点击左右箭头时,轮播图自动向左或向右,并且小圆点跟随运动

    3. 点击小圆点时,图片切换到对应的图片

    4. 自动轮播,每2s一次

代码中图片根据自己需要,新建一个images文件夹,将图片定义为1.jpg-5.jpg即可,也可添加多个

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>简单的轮播图</title>
        <style>
            ul {
                list-style: none;
                position: absolute;
                margin: 0;
                padding: 0;
                left: 0;
                width: 1000%;
            }
    
            img {
                width:400px;
                height:300px;
            }
    
            .box {
                width: 400px;
                height: 300px;
                margin: 100px auto;
                padding: 0px;
                border: 1px solid gray;
            }
    
            .inner {
                width: 400px;
                height: 300px;
                background-color: pink;
                overflow: hidden;
                position: relative;
            }
    
            .inner li {
                float: left;
            }
    
            .circle {
                position: absolute;
                right:150px;
                bottom: 3px;
            }
    
            .circle li {
                display: inline-block;
                width: 10px;
                height: 10px;
                background-color: white;
                border-radius: 50%;
                text-align: center;
                line-height: 8px;
                cursor: pointer;
                margin: 8px;
            }
    
            .circle .current {
                background-c
  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值