Animate DIV to another DIV position -


i can't figure out how animate div goes #slot1 position (and later slot choose).

here javascript code , fiddle

$(function (){   $('#deck').click(function (){     var slotpos = $('#slot1').position();     $(this).animate({left: slotpos.left}, 400);   });  }); 

http://jsbin.com/ejeweb/4/

thanks in advance!

$(#slot1 ).position() 

function giving relative position w.r.t to

<div id='head'> 

container. can try below code. , use accordingly it:

  $(function (){   $('#deck').click(function (){ var slotpos = $('#slot1').position(),        hand=$("#hand").position();     $("#deck").animate({    left: 10+hand.left+slotpos.left,    top:10 + hand.top},    400); }) } ); 

let me know if works you!


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -