Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

jQuery.animate having hard time moving a div, right to left

jQuery.animate having hard time moving a div, right to left

Problem

I am trying to move the box from right to Left, by 50px when the Document loads. Ive done quite a bit of searching, and im stumped.

At first I thought this would be easy to do, and I was going to be off away coding a click event into it for fun, but here I am stuck.

Here is the HTML




    HTML

Here is my CSS

#box {

width: 40px;
height: 40px;

background-color: blue;

margin: 1px;
top:10px;
position:absolute;}

#obs {width: 15px;
height: 15px;
border: solid, 2px;
background-color: red;}

Here is my jQuery

$(document).ready(function() {   
$('#box').animate({left: "+=50px",'slow'}, 1000);
});
Problem courtesy of: Abe Lincolnn

Solution

try with this one:

$('#box').animate({left: "+=50px"}, 1000);

remove 'slow'. checkout the fiddle here

I am trying to move the box from right to left, by 50px when the Document loads.
This comment is not correct your code moves the #box to left to right by 50px

Solution courtesy of: Jai

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

jQuery.animate having hard time moving a div, right to left

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×