私は小さなスクリプトに取り組んでいます。これでほぼ完了です。必要な変更はほとんどありません。ここでデモを参照してください。私がやりたいのは、「こんにちは友達」と言うボックスは1つだけですが、すぐに2〜3個のボックスをクリックすると、複数のボックスに「こんにちは友達」と表示されます。
$(document).ready(function(){
$(".main").click(function(){
if($('.active').length){
// Slide down previous theater
$(this).animate({
top: '+=0',
}, 200, function() {
$(".main").removeClass("active");
});
$(".active").next("div").animate({
top: '+=270',
}, 200, function() {
});
}
// slide up new theater
$(this).animate({
top: '-=0',
}, 200, function() {
$(this).addClass("active");
});
$(this).next("div").animate({
top: '-=270',
}, 200, function() {
});
});
});