12
rated 0 times
[
19]
[
7]
/ answers: 1 / hits: 29618
/ 12 Years ago, thu, august 9, 2012, 12:00:00
I have multiple divs (haveing same class names). I want to move the div (always same div, which has unique ID #pos1
) to the div which has been clicked. So, for that purpose, I am using following code to find the position1 (of the div which I want to move) and pos2 (the div which is clicked).
However, I don't know know how can I move (animate etc) the div from one position to another. I will appriciate any help.
jQuery(.container).click(function() {
var pos1 = jQuery(#pos1).position();
alert(pos1.top + ', ' + pos1.left);
var pos2 = jQuery(this).position();
alert(pos2.top + ', ' + pos2.left);
});
More From » jquery