开发者

jQuery remove appended element

I'm trying to have a form fade away then show a message "connecting your call" then after 3 seconds the "connecting your call" message fades away and after 30 seconds the form comes back. The form is hiding a开发者_C百科nd coming back just find I just can't figure out how to make the dynamic appended tag fade. Any suggestions would be great

$("#form").hide().delay(30000).fadeIn('slow');
$("#formarea").append("<h3>Connecting your call...</h3>").delay(3000).$('h3').fadeOut('slow');


You have a $ selector and should be using find:

$("#form").hide().delay(30000).fadeIn('slow');
$("#formarea")
    .append("<h3>Connecting your call...</h3>")
    .delay(3000)
    .find('h3')
        .fadeOut('slow');

The problem with delaying through is that it only works on the effects queue, and the next item in the chain is not an effects function. Try this:

$("#form").hide().delay(30000).fadeIn('slow');
    $("#formarea")
        .append("<h3>Connecting your call...</h3>")
        .find('h3')
            .delay(3000)
                .fadeOut('slow');


$("#formarea > h3").fadeOut(3000);

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜