hi,

i was just playing around today with some animations.

this is my code (js):
$("#boden").mousemove(function(e)
        {
        var pageCoords = "( " + e.pageX + ", " + e.pageY + " )";
        var clientCoords = "( " + e.clientX + ", " + e.clientY + " )";
        $("span:first").text("( e.pageX, e.pageY ) - " + pageCoords);
        $("span:last").text("( e.clientX, e.clientY ) - " +
clientCoords);

                $(this).click(function()
                {
                        var bodenoff = $("#boden").offset();
                        var balltop = (e.clientY*1) - (bodenoff.top*1);
                        var ballleft = (e.clientX*1) - (bodenoff.left*1);
                        $("#ball").stop().animate({top:balltop, 
left:ballleft},"normal");
                });
    });

html:
<div id="grund">
        <div id="boden">
                <div id="ball">
            </div>
        </div>
    </div>

css:
#grund{background-color:#003366;height:300px;width:300px;margin:auto}
#boden{background-color:#6699FF;height:100px;width:auto;top:
200px;position:relative}
#ball{background-color:#CC0033;height:30px;width:
30px;position:relative;



it is just moving a little div in an other div to the point where you
clicked. it works pretty well but after 20-30 clicks the animations
takes some time to fire again and i wonder why. someone got an idea?

Reply via email to