我做了这样:
代码笔或代码下来
$(document).ready(function () {
var btn1Status = 0;
$("button").click(function () {
if (btn1Status === 0) {
$(".info").slideDown();
$(".info").show("slow");
$("button").text("less");
btn1Status = 1;
} else {
$(".info").slideUp();
$(".nfo").hide("slow");
btn1Status = 0;
$("button").text("More");
}
});
});
button {
background-color: black;
color: white;
width: 50px;
height: 30px;
}
button:focus {
outline: none;
}
ul {
list-style-type: none;
margin: 10px;
padding: 0;
}
.info {
background-color: black;
color: white;
font-family: arial;
width: 400px;
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<div><img src="https://img.favpng.com/22/6/0/portable-network-graphics-movie-camera-film-clip-art-computer-icons-png-favpng-qfZ7hHPN2CCxiK8sYfjS2Sti9.jpg" width="400"><button>More</button></div>
<div class="info">
<ul>
<li>Name: movie1</li>
<li>Time: 6:00PM</li>
<li>Info 3 : blablabla</li>
<li>Info 4 : blablabla</li>
</ul>
</div>
。
当有人单击该按钮时,应显示信息 div。问题是,如果我多次单击该按钮,然后将其抬起,它将继续显示和消失。如何解决此问题。感谢您的帮助。
拉风的咖菲猫
相关分类