我正在使用此代码进行常见问题解答。您单击 img 会打开该框,单击该 img 也会关闭该框。img 在每次点击时切换。到目前为止,我还无法将其转换为与 1 个以上的部分一起使用。我对 jquery 或 javascript 一无所知,但了解一些编程概念。我已经尝试了4个小时没有运气。我需要你的帮助!
$(document).ready(function() {
$('#expandcontract').toggle(
function(){ // you can add as much here as you'd like
$('#box').show('slow');
$('#imgArrows').attr("src","images/up.png");
}, function() { // same here
$('#box').hide('slow');
$('#imgArrows').attr("src","images/down.png");
});
});