运用html相关知识编写导航栏和二级菜单

news/2024/4/29 1:56:09

相关代码:

<!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;}#left {width: 200px;}#left ul {width: 200px;background: rgba(105, 101, 101, .6);color: #fff;}#left ul li {width: 200px;height: 50px;font-size: 20px;border: 1px solid #666;line-height: 50px;}#left ul li:hover {background-color: #ff6700;}.right {max-width: 1200px;overflow: hidden;min-width: 300px;height: 550px;position: absolute;top: 0px;left: 230px;display: none;background-color: #fff;}.right ul {height: 550px;display: none;flex-direction: column;flex-wrap: wrap;}.right ul li {width: 200px;margin-right: 10px;height: 110px;}.right ul li:hover {color: #ff6700;}</style>
</head><body><div id="left"><ul></ul></div><div class="right"><ul class="submenu"></ul></div><script src="./js/14xiaomi.js"></script><script src="./js/jquery.js"></script><script>// 将数组遍历出来,然后放到左侧盒子里面var str1 = '';$(menu).each(function (index, item) {str1 += `<li>${item}</li>`})$('#left ul').html(str1);// 右边盒子var str2 = '';$(data).each(function (index2, item2) {var str3 = '';$(item2.list).each(function (index3, item3) {str3 += `<li><img src="${item3.url}" alt=""><p>${item3.title}</p></li>`})str2 += `<ul class="submenu">${str3}</ul>`})$('.right ').html(str2);$('#left>ul>li').on('mouseover', function () {var idx = $(this).index();$('.right').show();$('.right .submenu').eq(idx).css('display', 'flex').siblings('.submenu').hide();})</script>
</body></html>

运行效果: 

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

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

相关文章

Gitlab光速发起Merge Request

前言 在我们日常开发过程中需要经常使用到Merge Request&#xff0c;在使用过程中我们需要来回在开发工具和UI界面之前来回切换&#xff0c;十分麻烦。那有没有一种办法可以时间直接开发开工具中直接发起Merge Request呢&#xff1f; 答案是有的。 使用 Git 命令方式创建 Me…

基于鹦鹉优化算法(Parrot optimizer,PO)的无人机三维路径规划(提供MATLAB代码)

一、无人机路径规划模型介绍 无人机三维路径规划是指在三维空间中为无人机规划一条合理的飞行路径&#xff0c;使其能够安全、高效地完成任务。路径规划是无人机自主飞行的关键技术之一&#xff0c;它可以通过算法和模型来确定无人机的航迹&#xff0c;以避开障碍物、优化飞行…

医学图像目标跟踪论文阅读笔记 2024.03.08~2024.03.14

“Inter-fractional portability of deep learning models for lung target tracking on cine imaging acquired in MRI-guided radiotherapy” 2024年 期刊 Physical and Engineering Sciences in Medicine 医学4区 没资源&#xff0c;只读了摘要&#xff0c;用的是U-net、a…

GPT出现Too many requests in 1 hour. Try again later.

换节点 这个就不用多说了&#xff0c;你都可以上GPT帐号了&#xff0c;哈…… 清除cooki 然后退出账号&#xff0c;重新登录即可

使用vscode+clangd+bear+publickeyssh远程开发Linux程序

目录 配置ssh密钥远程登录登录远程Linux主机安装必要软件安装vscode插件1.安装remote-ssh插件2.通过vscode远程连接到linux机器3.在远程安装插件clangd4.关闭C/C Intellense engine 使用vscodeclangdbear1.修改Makefile2.编译内核3.结果 配置ssh密钥远程登录 一定要配置成密钥…

蓝桥杯练习题——树状数组和线段树

树状数组 时间复杂度&#xff1a;O(logn)&#xff0c;查询和修改都是 解决问题&#xff1a;单点修改、区间查询&#xff0c;也可以区间修改&#xff0c;单点查询 原理&#xff1a;数组下标必须从 1 开始&#xff0c;如果下标二进制最右边有 k 个 0&#xff0c;那就是第 k 层&a…