当前位置: 首页 > news >正文

#第十二题

第十二题

<!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>

        .box {

            width: 800px;

            height: 600px;

            border: 2px solid red;

            position: fixed;

            margin-top: 200px;

            left: 430px;

        }

        .im a {

            position: absolute;

            width: 100%;

            height: 100%;

            display: none;

        }

        .im a>img {

            width: 100%;

            height: 100%;

        }

        .im {

            width: 100%;

            height: 100%;

        }

        .l {

            position: absolute;

            top: 50%;

            font-size: 30px;

            font-weight: bolder;

            display: none;

        }

        .r {

            position: absolute;

            top: 50%;

            right: 0;

            font-size: 30px;

            font-weight: bolder;

            display: none;

        }

        .bn {

            position: absolute;

            bottom: 20px;

            left: 360px;

            display: flex;

        }

        .bn span {

            width: 14px;

            height: 14px;

            border-radius: 100%;

            background: red;

            display: block;

            margin-right: 10px;

        }

        .bn1 {

            background: blue !important;

        }

        .mn {

            display: block !important;

        }

    </style>

</head>

<body>

    <div>

        <div class="box">

            <div class="im">

                <a href="#" class="mn"><img src="52523231843051092851738667855577.jpg"></a>

            </div>

            <div class="l" >&lt;</div>

            <div class="r">&gt;</div>

            <div class="bn">

                <span class="bn1"></span>

                <span></span>

                <span></span>

                <span></span>

            </div>

        </div>

    </div>

    <script>

        window.onload = function () {

            const im = document.querySelector('.im')

            const box = document.querySelector('.box')

            const l = document.querySelector('.l')

            const r = document.querySelector('.r')

            const ima = document.querySelectorAll('.im a')

            const s = document.querySelectorAll('.bn span')

            const img = document.querySelector('.im img')

            let i = 0

            const date = [

                { url: '52523231843051092851738667855577.jpg' },

                { url: 'IMG_20250203_191203.jpg' },

                { url: 'IMG_20250203_191417.jpg' },

                { url: '52540120473724869791738579278581.jpg' },

            ]

            l.addEventListener('click', function () {

                i--

                if (i < 0) {

                    i = date.length - 1

                }

                img.src = date[i].url

                document.querySelector('.bn .bn1').classList.remove('bn1')

                document.querySelector(`.bn span:nth-child(${i + 1})`).classList.add('bn1')


 

            })

            r.addEventListener('click', function () {

                i++

                if (i >= date.length) {

                    i = 0

                }

                img.src = date[i].url

                document.querySelector('.bn .bn1').classList.remove('bn1')

                document.querySelector(`.bn span:nth-child(${i + 1})`).classList.add('bn1')

            })

            let time = setInterval(function () {

                r.click()

            }, 1000)

            box.addEventListener('mouseenter', function () {

                clearInterval(time)

                l.style.display = 'block'

                r.style.display = 'block'

            })

            box.addEventListener('mouseleave', function () {

                clearInterval(time)

                l.style.display = 'none'

                r.style.display = 'none'

                time = setInterval(function () {

                r.click()

            }, 1000)})

         

        }

    </script>

</body>

</html>

相关文章:

  • window中git bash使用conda命令
  • 数据分析、商业智能、业务分析三者之间的关系
  • 计算机毕业设计hadoop+spark旅游景点推荐 旅游推荐系统 旅游可视化 旅游爬虫 景区客流量预测 旅游大数据 大数据毕业设计
  • MapReduce的工作原理及其在大数据处理中的应用
  • 多层代理模式解析Invocation
  • 重构测试项目为spring+springMVC+Mybatis框架
  • Debezium同步之如何同步GIS数据
  • 李代数和李群的转化方法
  • 计算机专业知识【软件开发中的常用图表:E - R图、HIPO、DFD、N - S、PAD详解】
  • STM32 HAL库USART串口中断编程:演示数据丢失
  • AI 百炼成神:线性回归,预测房价
  • ESP32 ESP-IDF TFT-LCD(ST7735 128x160) LVGL基本配置和使用
  • PID控制学习
  • [java详细总结] java中的String详解
  • PhotoShop新版脚本编辑工具安装
  • cornerstone3D学习笔记-MPR
  • Web 后端 请求与响应
  • 【Javascript Day17】事件传播、事件对象
  • 基于C++重构muduo网络库搭建HTTP服务器项目设计及反思
  • ffmpeg 多路流处理在iOS的具体使用
  • 做网站为什么没收入/今天重大新闻头条新闻军事
  • 以百度云做网站空间/产品推销
  • 怎么做网站不用备案/搜狗搜索网
  • seo网站排名优化教程/友链提交入口
  • 福州网站建设哪家好/国内最大的搜索引擎
  • 模板设计建站/商业策划公司十大公司