evuez
evuez

Reputation: 3387

expand an element from right to left

I would like to make a li element expand from right to left. I mean, if my element has the following css :

li{
   position:absolute
   left:10%;
   top:40px;
   width:100px;
}

how can I make that element top expand to the left with jquery, so that its top-right won't move, and it will be its left border that will move?

For now, I just have the following jquery, doing the same thing... from left to right:

$('li').animate({width:'+=100'},400);

Thanks in advance for helping!

Upvotes: 1

Views: 9665

Answers (2)

scornork
scornork

Reputation: 1369

there is a similar query on this that you can find here: jQuery slide left and show

Upvotes: 1

jtbandes
jtbandes

Reputation: 118681

I recommend setting your element's position using top: and right: rather than top: and left: in CSS, so when it grows the right side remains in the same place.

Upvotes: 7

Related Questions