January 30, 201016 yr I have a content box with a nav which updates via xhr/ajax. When a link is clicked it displays a loading icon and loads the new content and. It's working fine, However i want old content to slide out to the left, and new content to slide in via the right. Whenever i try to do this via the animate function theirs a little lag which seperates the old and new content. Anyone know the best approach to do this? The only thing i can think of is this kind of process. Link clicked > Create replica content are to the right > Load content into new area > Content loaded > Slide Both content areas right > Destroy Old content area. It just seems kind of long winded, is their a better approach i can take?
February 10, 201016 yr Author Yeah but doing that creates a lag between the two animations. I need them to run together. Currently i'm just using a fade, updateHandler: { "#content": function (a) { $(this).animate({ opacity: '0' }, function () { $(this).html(a).animate({ opacity: '1' }) }) } But like above, it's going to: Fade out > Load content > Fade In If i animate it as a slide effect it'll Slide out > Load Content > Slide In I want it to Load Content > Slide old content out & slide new content in (together). I just don't know the easiest way of doing this. EDIT: I'm using the jQuery.ajax() function.
March 8, 201016 yr Author Didn't see you'd replied... You could also try adding a function in the beforeSend callback too - although in the past I've had problems trying to get that to work in IE6 for some reason I'll look into that, thanks. IE6 isn't a support issue for me Don't know how well it'll work, we've updated the animation method, to run through a specified set of components and animate them individual (you should watch the cpu usage burst at this point). $('.tab' + number + ' .animate_me').each(function(i){ var speed = 450; var this_css_left = jQuery(this).css("left"); var pos_left = parseInt(this_css_left.replace(/px/g, "")); var adjust_left = pos_left + ((i+1) * 35); $(this).animate({left:adjust_left},speed,"linear").animate({left:pos_left},300); }); It creates a pretty cool effect though. Projects on hold atm (or indefinitely) though
Create an account or sign in to comment