jquery move image from one place to the other using offsets giving weir results
<p>I've been trying to make image moving animation along the straight line, but have failed miserably :) It goes totally in the wrong direction, and I cannot figure out why...</p>

<p>Please visit: <a href="http://kpi.ge/ultrasound-systems/philips-hdi5000/" rel="nofollow">http://kpi.ge/ultrasound-systems/philips-hdi5000/</a></p>

<p>And click "add to compare box" next to get-quote button.</p>

<p>Animation starts from there and should go straight to the left where compare box is... but it goes down and than appears in the right spot. I'm pretty sure there is something with parent offset not being correct, but as I understand offset is in relation to the document window, so  the result confuses me...</p>

<p>jquery:</p>

<pre><code>var product_img = data;
var fdest_pos = $("#compareproducts").offset();


if (!$("#compareleft").has(".compareprodimg").length &amp;&amp; !$(".compareboxbtn").has(".compareprodimg").length) {
    $("#clickedthis").append(product_img);
    $("#clickedthis").removeAttr("id");
    $(".compareboxbtn").children(".compareprodimg").css({
        position: "absolute"
    }).animate({
        left: fdest_pos.left,
        top: fdest_pos.top
    }, {
        complete: function () {

            $(this).removeAttr("style");
            $(this).appendTo("#compareleft");
            $("#compareleft").attr("class", "on");
            $("#compareleft").attr("href", get_param_url);

            //save to session
            $.session.set("compareLeftContent", product_img);
            $.session.set("compareLeftId", get_param_url);


            // if href is numeric turn on compare now button
            if ($("#compareleft").attr("href") &gt; 0 &amp;&amp; $("#compareright").attr("href") &gt; 0) {

                $("#compareproducts .button").removeClass("off");
                $("#compareproducts .button").addClass("on");
                $("#compareproducts .button.on").on("click", function () {
                    window.location = "/kpi/compare/?product=" + $("#compareleft").attr("href") + "," + $("#compareright").attr("href");
                });

                $(".button.on").unbind("mouseenter mouseleave"); //Remove helper pop-up "add another product"


            } // if

        }
    });
} // if left
</code></pre>
