开发者

JQuery can I display the result then have it fade away?

Is there a way I can display the result and then have it fade away after about 10 seconds or something using JQuery?

Here is the code.

function stop(){
    $.ajax({
        type: "GET",
        url: "http://update.php",
        data: "do=getSTOP",
        cache: false,
        async: false,
        success: function(result) {
            $("#rate").html(result);
        },
  开发者_如何学运维      error: function(result) {
            alert("some error occured, please try again later");
        }
    });

    return false;
}

$(document).ready(function() {

    $('.rating li a, .srating li a').click(stop);

});


You can use .delay() for this, like this:

$("#rate").html(result).delay(10000).fadeOut();

This does a .delay() for 10 seconds then performs a .fadeOut() animation, no reason to make it any more complicated I think :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜