在CSS悬停事件上,我可以更改另一个div的样式吗?当我悬停在id为“a”的div或类上时,可以更改div的背景色或id为“b”的类吗?
3 回答

浮云间
TA贡献1829条经验 获得超4个赞
$(function() { $('#a').hover(function() { $('#b').css('background-color', 'yellow'); }, function() { // on mouseout, reset the background colour $('#b').css('background-color', ''); });});

尚方宝剑之说
TA贡献1788条经验 获得超4个赞
$(document).ready(function(){ $("#a").mouseover(function(){ $("#b").css("background-color", "red"); });});
- 3 回答
- 0 关注
- 1315 浏览
相关问题推荐
添加回答
举报
0/150
提交
取消