我想让用户点击一个方框时显示一个 div
。我尝试使用以下代码:
$(document).ready(function(){
$(".hold").mousedown(function(){
$(".box").css("height","200px");
});
$(".hold").mouseup(function(){
$(".box").css("height","0px");
});
});
但是代码的第二部分,
mouseup
事件在我点击和拖动时并没有触发回调函数。如何让它起作用?
<!DOCTYPE html>
<html>
<head>
<title>click and hold project</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<div class="hold"></div>
<div class="box"></div>
<script src="jquery-2.2.3.min.js"></script>
<script src="app.js"></script>
</body>
</html>
.box
中进行“mouseupping”。 - wahwahwah