将下面的jquery换成javascript代码$(function () { //4.banner旁菜单l-list $(.l-list).children(li).hover(function () { $(this).css({ backgroundColor: #ff6700 }).siblings().css({ back
时间: 2024-04-02 14:34:32 浏览: 23
document.addEventListener("DOMContentLoaded", function() {
let lList = document.querySelector(".l-list");
let liList = lList.children;
for(let i = 0; i < liList.length; i++) {
liList[i].addEventListener("mouseenter", function() {
this.style.backgroundColor = "#ff6700";
for(let j = 0; j < liList.length; j++) {
if(j != i) {
liList[j].style.backgroundColor = "";
}
}
});
liList[i].addEventListener("mouseleave", function() {
this.style.backgroundColor = "";
});
}
});
相关问题
"https://code.jquery.com/jquery-3.6.0.min.js"
这是 jQuery JavaScript 库的链接,可以用来在网页中引入 jQuery。jQuery 是一个广泛使用的 JavaScript 库,提供了许多简化 DOM 操作、处理事件、实现动画效果等功能的 API。通过在 HTML 页面中引入 jQuery 库,我们可以更加方便地编写 JavaScript 代码。
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>是什么意思
这个是引入jQuery库的代码,它的作用是在网页中加载jQuery库,以便在网页中使用jQuery的功能。jQuery是一个JavaScript库,它简化了JavaScript的编写,提供了许多便捷的API,对于编写JavaScript代码的开发者来说,使用jQuery可以更加简洁、易懂地编写JavaScript代码。这行代码会从指定的URL加载jQuery,并将其添加到网页中,以便网页中的其他脚本可以使用jQuery。
相关推荐
![js](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)