0

私のjQueryコードは次のとおりです。

jQuery(document).ready(function ($) {
    $("#comment_submit").on('click', function () {
        var message = $("#pc_message").val();

        var uid = $("#uid").val();
        var from_uid = $("#from_uid").val();

        if (message == '') {
            alert("Message is missing!!");
            return;
        }
        $.ajax({
            type: "post",
            dataType: "html",
            url: "pro_profile.php?action=do_comment",
            data: "message=" + message + "&uid=" + uid + "&from_uid=" + from_uid,
            success: function (response) {
                $('#show_profile_comments').html(response);
                document.getElementById('pc_message').value = '';
                document.getElementById('pc_message').focus();
            },
            error: function (response) {
                alert(response.responseText);
            }
        });
        return false;
    });
});

私は#show_profile_commentsfadeInまたはslideDown効果になりたいのですが、これら2つのjQuery関数のいずれかを使用すると、fadeInでもslideDownでもありません。

私はこれを試しています。

$('#show_profile_comments').fadeIn("slow").html(response);

しかし、それは機能せず、メッセージは何の効果もなく投稿されます。コードに何か問題がありますか?

助けてください!

4

2 に答える 2

1

考えられる理由の 1 つは、要素が既に表示されているため、fadeInまたはのようなメソッドslideDownは効果がない可能性があります...

試す

$('#show_profile_comments').hide().html(response).fadeIn("slow");
于 2013-10-27T12:28:24.833 に答える
0

Arun が投稿した提案が、その ID が使用されているテーブル全体にフェードインすることを覚えておいてください。それぞれにフェードイン効果を表示していた場合bit of table or row(コードから明らかです)、IDを割り当てます。たとえばid="lcb"、テーブルに追加して<td>置換します。

$('#show_profile_comments').html(response);

と;

$('#show_profile_comments').html(response);
$('#lcb').hide().fadeIn("slow");

これにより、td-s を分離するためのフェードイン効果が得られます

于 2013-10-27T13:19:07.727 に答える