jQuery Uncaught TypeError: Cannot read property 'offsetLeft' of undefined
<p>This is causing me problems with getting the position of an element and then using it to position another element to the right of it. Any help would be appriciated.</p>

<p>I'm using jQuery 2.0.0 if that makes any difference</p>

<pre><code>(function($) {
 $.fn.lavaLamp = function(o) {
o = $.extend({ fx: "linear", speed: 500, click: function(){} }, o || {});

return this.each(function() {
    var me = $(this), noop = function(){},
        $back = $('&lt;li class="back"&gt;&lt;div class="left"&gt;&lt;/div&gt;&lt;/li&gt;').appendTo(me),
        $li = $("a", this), curr = $("li.current", this)[0] || $($li[0]).addClass("current")[0];

    $li.not(".back").hover(function() {
        move(this);
    }, noop);

    $(this).hover(noop, function() {
        move(curr);
    });

    $li.click(function(e) {
        setCurr(this);
        return o.click.apply(this, [e, this]);
    });

    setCurr(curr);

    function setCurr(el) {
        $back.css({ "left": el.offsetLeft+"px", "width": el.offsetWidth+"px" });
        curr = el;
    };

    function move(el) {
        $back.each(function() {
            $(this).dequeue(); }
        ).animate({
            width: el.offsetWidth,
            left: el.offsetLeft
        }, o.speed, o.fx);
    };

});
};
})(jQuery);
</code></pre>
