I have this:
if($('.content', wrapper).length === 0)
$(data[current].content).appendTo(wrapper);
else
$('.content', wrapper).replaceWith($(data[current].content));
var el = $('.content', wrapper);
which is working, but this code, which should do the same:
var el = ($('.content', wrapper).length === 0)
? $(data[current].content).appendTo(wrapper)
: $('.content', wrapper).replaceWith($(data[current].content));
is screwing up my CSS.
el seems to be the same in both cases, but for some weird reason my animations that follow after this go wrong, most likely because of some CSS changes…
What am I doing wrong?
.replaceWith will return the content that was replaced(and is no longer in the DOM). From the jQuery docs: