前端的页面代码

        根据老师教的前端页面的知识,加上我也是借鉴了老师上课所说的代码,马马虎虎的写出了页面。如下代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="./css/reset_css.css">
    <link rel="stylesheet" href="./css/data_css.css">
</head>
<body>
<div class="box">
    <div class="img1">
        <ul>
            <li><img style="z-index: 1" src="./images/大图1.webp" alt=""></li>
            <li><img src="./images/大图2.webp" alt=""></li>
            <li><img src="./images/大图3.webp" alt=""></li>
            <li><img src="./images/大图4.webp" alt=""></li>
        </ul>
    </div>
    <div class="img2">
        <ul>
            <li><img style="z-index: 11" src="./images/小图1.webp" alt=""></li>
            <li><img src="./images/小图2.webp" alt=""></li>
            <li><img src="./images/小图3.webp" alt=""></li>
            <li><img src="./images/小图4.webp" alt=""></li>
        </ul>
    </div>
    <div class="btn">
        <ul id="l1">
            <li><img style="z-index: 11" class="img1" src="./images/按钮左1.webp" alt=""></li>
            <li><img class="img1" src="./images/按钮左2.webp" alt=""></li>
            <li><img class="img1" src="./images/按钮左3.webp" alt=""></li>
            <li><img class="img1" src="./images/按钮左4.webp" alt=""></li>
        </ul>
        <ul id="l2">
            <li><img style="z-index: 11" class="img2" src="./images/按钮右1.webp" alt=""></li>
            <li><img class="img2" src="./images/按钮右2.webp" alt=""></li>
            <li><img class="img2" src="./images/按钮右3.webp" alt=""></li>
            <li><img class="img2" src="./images/按钮右4.webp" alt=""></li>
        </ul>
    </div>
    <div class="cir">
        <ul>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>

</div>
<script src="./js/date.js"></script>
</body>
</html>

        运行此代码时,还需要联合css和js代码。

        js代码如下:

var img=document.querySelectorAll(".box .img1 li img")
var img1=document.querySelectorAll(".box .img2 li img")
var cir=document.querySelectorAll(".box .cir li")
var btn=document.querySelectorAll(".box .btn .img1")
var btn1=document.querySelectorAll(".box .btn .img2")

function f1(i) {
    for (let j=0;j<cir.length;j++){
            img[j].setAttribute("style", "z-index:0")
        img1[j].setAttribute("style", "z-index:0")
            btn[j].setAttribute("style", "z-index:0")
        btn1[j].setAttribute("style", "z-index:0")
        }
        img[i].setAttribute("style", "z-index:"+(i+1))
        img1[i].setAttribute("style", "z-index:"+(i+11))
        btn[i].setAttribute("style", "z-index:"+(i+11))
        btn1[i].setAttribute("style", "z-index:"+(i+11))
}

for (let i=0;i<cir.length;i++){
    cir[i].onclick=function () {
        f1(i)
        index=i
    }
}

var l1=document.getElementById("l1")
var l2=document.getElementById("l2")
var index=0
l2.onclick=function () {
    if (index == img.length-1){
        index=0
    }else{
        index++
    }f1(index)
}

l1.onclick=function () {
    if (index == 0){
        index=img.length-1
    }else{
        index--
    }f1(index)
}

        css代码如下:

1)data文件代码

.box{
    width: 1800px;
    height: 800px;
    margin: 20px auto;
    position: relative;
    left: 0;
    top: 0;
}
.box .img1 img{
    width: 1800px;
    height: 800px;
    position: absolute;
    top: 0;
    left: 0;
}
.box .img2 img{
    width: 700px;
    height: 350px;
    position: absolute;
    top: 30%;
    left: 30%;
    margin-top: -50px;
    margin-left: 15px;
}
.box .btn .img1{
    width: 75px;
    height: 75px;
    position: absolute;
    top: 50%;
    left: 20%;
    margin-left: 80px;
    margin-top: -75px;
}
.box .btn .img2{
    width: 75px;
    height: 75px;
    position: absolute;
    top: 50%;
    right: 20%;
    margin-right: 80px;
    margin-top: -75px;
}
.box .cir ul{
    position: absolute;
    left: 50%;
    bottom: 25%;
    transform: translateX(-50px);
    margin-left: -10px;
    z-index: 50;
}
.box .cir li{
    width: 10px;
    height: 10px;
    background-color: forestgreen;
    border-radius: 50%;
    float: left;
    margin-right: 5px;
    border: forestgreen solid 5px;
}
.box .cir li:hover{
    background-color: dimgray;
}
.box .btf #img3{
    position: absolute;
    bottom: 5%;
    left: 30%;
    margin-left: 40px;
    margin-bottom: 5px;
    z-index: 50;
}
.box .btf #img4{
    position: absolute;
    bottom: 5%;
    left: 40%;
    margin-left: 20px;
    margin-bottom: 5px;
    z-index: 50;
}
.box .btf #img5{
    position: absolute;
    bottom: 5%;
    left: 50%;
    margin-left: 35px;
    margin-bottom: 5px;
    z-index: 50;
}
.box .btf #img6{
    position: absolute;
    bottom: 5%;
    right: 30%;
    margin-right: 40px;
    margin-bottom: 5px;
    z-index: 50;
}

2)reset文件代码

/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

        结合上述前端代码,运行如下:

        在此是用老师发送原神图片练习的。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/796738.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

小型 FPGA 瞄准 4K 视频接口,MiSTer FPGA 现已支持 Sinden 光枪-FPGA新闻速览

无需矩阵乘法&#xff0c;在 FPGA 上实现低功耗、高性能的 LLM UC Santa Cruz, Soochow University, UC Davis 和 LuxiTech 发表了一篇题为“可扩展的无 MatMul 语言建模”的新技术论文。 “矩阵乘法 (MatMul) 通常占据大型语言模型 (LLM) 总体计算量的主导地位。随着 LLM 扩展…

PLC物联网关在工业自动化领域的应用的意义-天拓四方

随着信息技术的飞速发展&#xff0c;物联网技术正逐步渗透到各个行业领域&#xff0c;其中&#xff0c;工业自动化领域的PLC与物联网的结合&#xff0c;为工业自动化的发展开辟了新的道路。PLC物联网关作为连接PLC与物联网的重要桥梁&#xff0c;其重要性日益凸显。 PLC物联网…

单例模式Singleton

设计模式 23种设计模式 Singleton 所谓类的单例设计模式&#xff0c;就是采取一定的方法保证在整个的软件系统中&#xff0c;对某个类只能存在一个对象实例&#xff0c;并且该类只提供一个取得其对象实例的方法。 饿汉式 public class BankTest {public static void main(…

四个“一体化”——构建数智融合时代下的一站式大数据平台

随着智能化技术的飞速发展&#xff0c;尤其是以生成式AI为代表的技术快速应用&#xff0c;推动了数据与智能的深化融合&#xff0c;给数据基础设施带来了新的变革和挑战。如何简化日益复杂的系统架构&#xff0c;提高数据处理效率&#xff0c;降低开发运维成本&#xff0c;促进…

Selenium使用注意事项:

find_element 和 find_elements 的区别 WebDriver和WebElement的区别 问题&#xff1a; 会遇到报错&#xff1a; selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector",&…

STM32智能空气质量监测系统教程

目录 引言环境准备智能空气质量监测系统基础代码实现&#xff1a;实现智能空气质量监测系统 4.1 数据采集模块 4.2 数据处理与控制模块 4.3 通信与网络系统实现 4.4 用户界面与数据可视化应用场景&#xff1a;空气质量监测与优化问题解决方案与优化收尾与总结 1. 引言 智能空…

UCSD和MIT的华人学者最新成果展示:沉浸式远程遥操作机器人

你是否曾想过&#xff0c;自己身处某地&#xff0c;可以控制几千公里以外的「机器人」本体&#xff1f;这个想法&#xff0c;最近被来自UCSD和MIT的华人学者们实现了。UCSD位于加利福尼亚州&#xff0c;MIT位于马萨诸塞州&#xff0c;这两地之差&#xff0c;约3000英里&#xf…

线性回归(梯度下降)

首先说案例&#xff1a; 房子的价格和所占面积有着很大的关系&#xff0c;假如现在有一些关于房子面积和价格的数据&#xff0c;我要如何根据已经有的数据来判断未知的数据呢&#xff1f; 假如x(房屋面积)&#xff0c;y(房屋价格) x[ 56 72 69 88 102 86 76 79 94 74] y[92, …

MySQL 锁分类

MySQL 锁分类 在 MySQL 中&#xff0c;为了保证并发性能和数据安全&#xff0c;有多种锁机制。我们常见的有表级锁和行级锁。让我们一起来学习 MySQL 中各种锁的知识。 表级锁 表级锁是对整张表进行锁定。 表数据锁 1. 读锁 允许多个会话同时读取同一张表的数据&#xff…

大模型时代的目标检测

https://zhuanlan.zhihu.com/p/663703934https://zhuanlan.zhihu.com/p/6637039341.open set/open word/ood 这个任务是指在实际应用上可以检测任何前景物体&#xff0c;但是有些不需要预测类别&#xff0c;只要检测出框就行。在很多场合也有应用场景&#xff0c;有点像类无关…

HyperSD - 会画草图就能玩AI绘画,AI一键手绘,实时同步 本地一键整合包下载

字节跳动的Lightning团队发布的新图像模型蒸馏算法Hyper-SD&#xff0c;是一项在图像处理和机器学习领域的重要进展。这项技术通过创新的方法提升了模型在不同推理步骤下的性能&#xff0c;同时保持了模型大小的精简。 基于这个算法模型&#xff0c;一个很实用的功能出现了&am…

知识图谱入门笔记

自学参考&#xff1a; 视频&#xff1a;斯坦福CS520 | 知识图谱 最全知识图谱综述 详解知识图谱的构建全流程 知识图谱构建&#xff08;概念&#xff0c;工具&#xff0c;实例调研&#xff09; 一、基本概念 知识图谱&#xff08;Knowledge graph&#xff09;&#xff1a;由结…

本地部署,MODNet 背景去除大模型

目录 摘要 引言 MODNet 架构 关键组件 技术原理 本地部署 运行结果 结论 GitHub - ZHKKKe/MODNet: A Trimap-Free Portrait Matting Solution in Real Time [AAAI 2022]A Trimap-Free Portrait Matting Solution in Real Time [AAAI 2022] - ZHKKKe/MODNethttps://gith…

【Linux】软件管理工具 yum

文章目录 概念搜索&#xff1a;yum list安装&#xff1a;yum install卸载&#xff1a;yum remove 概念 在Linux下安装软件&#xff0c;可以下载到程序的源代码&#xff0c;进行编译得到可执行程序&#xff0c;另外这些软件还有依赖其它工具的问题&#xff0c;还得下载编译这些依…

鸿蒙小练习

bean对象 export class BannerImage{id:numberurl:stringtargetUrl:stringproductId:numberconstructor(id: number, url: string, targetUrl: string, productId: number) {this.id idthis.url urlthis.targetUrl targetUrlthis.productId productId} }export class d…

嵌入式应用开发之模块驱动移植教程

前言:本篇主要面向小白的小伙伴&#xff0c;提供一些基础的模块移植教程&#xff0c;不涉及预处理指令类的移植教程。 #为什么要移植驱动 这个问题&#xff0c;可以来说是显而易见的&#xff0c;在标准库的开发过程中&#xff0c;如果重新写一个模块的驱动&#xff0c;从串行通…

Autosar Dcm配置-0x28服务ComControl-基于ETAS软件

文章目录 前言DcmDcmDsdDcmDspBswMBswMModeRequestPortBswMModeConditionBswMLogicalExpressionBswMActionBswMActionListBswMRule总结前言 0x28服务主要用来控制非诊断报文的通讯,一般在刷写预编程过程中,用来禁止APP的通信报文,可以减少总线负载率,提高刷写成功率。本文…

【Orange Pi AI Pro】开箱体验完,发现是真的强!!!

最近香橙派联合华为出了一款新的AI开发板——Orange Pi AI Pro&#xff0c;关键是搭载了昇腾AI处理器提供了8TOPS INT8的算力&#xff0c;作为一个嵌入式的CSDN博主&#xff0c;当然得体验一下这款新产品。 文章目录 1 开箱2 硬件介绍2.1 开发板硬件详情&#xff1a;2.2 顶层视…

分享浏览器被hao123网页劫持,去除劫持的方式

昨天看python相关的自动化工作代码时&#xff0c;发现谷歌浏览器被hao123劫持了&#xff0c;把那些程序删了也不管用 方法1&#xff1a;删除hao123注册表&#xff0c;这个方式不太好用&#xff0c;会找不到注册表 方法2&#xff1a;看浏览器快捷方式的属性页面&#xff0c;一…

keil5新建stm32工程的基本

1、建立工程文件夹&#xff0c;keil中新建工程&#xff0c;选择型号&#xff1b; 2、工程文件夹里建立自己所需要的文件夹等&#xff0c;复制固件库里面的文件到工程文件夹里&#xff1b; 3、将工程里建立对应的同名的分组&#xff0c;并将文件夹内的文件添加到工程分组中。 点…