I wanto to fadein only the append element
I try with this
$("ul#content-wall").append(msg.template).hide().fadeIn(300).promise().done(function () {
});
or
$("ul#content-wall").hide().append(msg.template).fadeIn('normal').promise().done(function () {
But Hide and fade in Whole container, i want hide and fadein Only
'msg.template'
Thanks
Update
i try to this
$(msg.template).hide().appendTo('#content-wall').fadeIn(300).promise().done(function () {});
But i have this error:
Uncaught Error: Syntax error, unrecognized expression: <li class="result_search">168foo</li>
my console.log(msg.template)
<li class="result_search"> 168 foo </li>
my console.dir(msg.template)
<li class="result_search">
168
foo
</li>
Use .appendTo() to get back the references to the newly appended elements and then animate it
$(msg.template).hide().appendTo('#content-wall').fadeIn(300).promise().done(function () {});
.append() returns the reference to the container element to which the new elements are added.
尝试这个:
$(msg.template).appendTo('ul#contentwall').hide().fadeIn(300).promise().done(function(){});
Try this
$(msgtemplate).appendTo($("ul#content-wall")).hide().fadeIn(500);
With your help and with the help of a user IRC (Cork):
$($.parseHTML(msg.template)).filter('*').appendTo('ul#content-wall').hide().fadeIn(300).promise().done(function () {}
I had an error without filter
Uncaught TypeError: Cannot set property 'cur' of undefined
Because first element in the array is a text node
fadeIn do $(template).eq(0) [textnode] .fade => crash
fadeIn do $(template).eq(1) [li] .fade => would work
Filter do (Corks said): it takes the array and loops through and gives you a new array with the elements that matched the selector,and as textNodes doesn't match selectors it should work with *
Update With jQuery 1.10.1 i haven't error
Uncaught TypeError: Cannot set property 'cur' of undefined
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.