javascript - Store positioning data before animating -


i want animate div jquery's animate(), load new content via ajax , animate original position. animate later back, i'm storing left position via data().

that's code far:

(function($){     //transition out $.fn.ajaxtransitionout = function() {     var origin = this.css('left');           var amount = $(window).width()*-1;      return $(this).data('origin',origin).stop().animate({left:amount, opacity:0}, 400);  };  })(jquery); 

second try:

(function($){     //transition out $.fn.ajaxtransitionout = function() {     var origin = $(this).css('left');     $(this).data('origin',origin)            var amount = $(window).width()*-1;      return $(this).data('origin',origin).stop().animate({left:amount, opacity:0}, 400);  };  })(jquery); 

problem: storing of old position slow , in data 'origin' value while animating object. (any minus-value)

if delay animation right value stored, that's not want.

any appreciated.

if use load instead, can fire function once load has finished. moreover, using ajax have options such before, success , complete. load example docs.

$('#result').load('ajax/test.html', function() {   alert('load performed.'); }); 

Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -