Using fadein and append

前端 未结 9 1962
不知归路
不知归路 2020-12-07 10:39

I am loading JSON data to my page and using appendTo() but I am trying to fade in my results, any ideas?

$(\"#posts\").fadeIn();
$(content).appe         


        
9条回答
  •  旧巷少年郎
    2020-12-07 11:31

    If you hide the content before you append it and chain the fadeIn method to that, you should get the effect that you're looking for.

    // Create the DOM elements
    $(content)
    // Sets the style of the elements to "display:none"
        .hide()
    // Appends the hidden elements to the "posts" element
        .appendTo('#posts')
    // Fades the new content into view
        .fadeIn();
    

提交回复
热议问题