move div to a div with animation

<div id="test1">test 1</div>
<div id="test 2">test 2</div>

how to move test1 to test2 with animation, and test2 will be slowly go away in jquery?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hi johndenny,

Try with file that i attached below........

Hope it helps....
johndennyAuthor Commented:
thanks mani, but that's a huge plugin, i just want to write my simple one, using animate .
And i just want to move test 1 to test2 div with a little animation.
Albert Van HalenAnalyst developerCommented:
You have to position the divs absolute at first.
Then use this code
$(function() {
	// Bind click event on document ready
	$("#test1").bind("click", function() {
		var o = $("#test2").offset();
			"left": o.left,
		}, "slow");
		$("#test2").fadeTo("slow", 0);

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

Dhanasekaran SengodanCommented:
hi johndenny:
                   Try this link.........
and also look at my sample  attached........
Try something like this
	//Cache selector for div1 and div2
	var $div1 = $("#div1");
	var $div2 = $("#div2");
	//Get the position of div1
	var pos1 = $div1.offset();
	//Get the position of div2
	var pos2 = $div2.offset();
	//animate div 1 to the position of div 2
	//Using div 1
	//Move to absolute positioning so we can move, but make sure it stay in the same place
	//Start animation
		//Now animation is finished, fade out div 2

Open in new window

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.