开发者

expand an element from right to left

开发者 https://www.devze.com 2023-03-20 18:04 出处:网络
I would like to make a li element expand from right to left. I mean, if my element has the following css :

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开发者_JAVA百科 the same thing... from left to right:

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

Thanks in advance for helping!


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消