请帮忙写一个简单的鼠标经过不同区域显示不同区块的js代码
发布网友
发布时间:2024-08-16 15:53
我来回答
共1个回答
热心网友
时间:2024-10-31 14:59
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<style>
.hi>div{width:30rem;height:30rem;}
.red{background: red;}
.green{background: green;display: none;}
.blue{background: blue;display: none;}
</style>
</head>
<body>
<div class="btn">
<button t="red">红</button>
<button t="green">绿</button>
<button t="blue">蓝</button>
</div>
<div class="hi">
<div class="red"></div>
<div class="green"></div>
<div class="blue"></div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(".btn>button").each(function(){
$(this).hover(function(){
$(".hi>div").hide();
var now=$(this).attr("t");
$("."+now).show();
})
})
</script>
</body>
</html>
热心网友
时间:2024-10-31 15:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<style>
.hi>div{width:30rem;height:30rem;}
.red{background: red;}
.green{background: green;display: none;}
.blue{background: blue;display: none;}
</style>
</head>
<body>
<div class="btn">
<button t="red">红</button>
<button t="green">绿</button>
<button t="blue">蓝</button>
</div>
<div class="hi">
<div class="red"></div>
<div class="green"></div>
<div class="blue"></div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(".btn>button").each(function(){
$(this).hover(function(){
$(".hi>div").hide();
var now=$(this).attr("t");
$("."+now).show();
})
})
</script>
</body>
</html>
热心网友
时间:2024-10-31 15:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<style>
.hi>div{width:30rem;height:30rem;}
.red{background: red;}
.green{background: green;display: none;}
.blue{background: blue;display: none;}
</style>
</head>
<body>
<div class="btn">
<button t="red">红</button>
<button t="green">绿</button>
<button t="blue">蓝</button>
</div>
<div class="hi">
<div class="red"></div>
<div class="green"></div>
<div class="blue"></div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(".btn>button").each(function(){
$(this).hover(function(){
$(".hi>div").hide();
var now=$(this).attr("t");
$("."+now).show();
})
})
</script>
</body>
</html>
热心网友
时间:2024-10-31 15:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test</title>
<style>
.hi>div{width:30rem;height:30rem;}
.red{background: red;}
.green{background: green;display: none;}
.blue{background: blue;display: none;}
</style>
</head>
<body>
<div class="btn">
<button t="red">红</button>
<button t="green">绿</button>
<button t="blue">蓝</button>
</div>
<div class="hi">
<div class="red"></div>
<div class="green"></div>
<div class="blue"></div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
$(".btn>button").each(function(){
$(this).hover(function(){
$(".hi>div").hide();
var now=$(this).attr("t");
$("."+now).show();
})
})
</script>
</body>
</html>