[英]expand an element from right to left
I would like to make a li element expand from right to left.我想让一个 li 元素从右向左扩展。 I mean, if my element has the following css:
我的意思是,如果我的元素具有以下 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?如何使用 jquery 使该元素顶部向左扩展,以使其右上角不会移动,而左边框将移动?
For now, I just have the following jquery, doing the same thing... from left to right:现在,我只有以下 jquery,做同样的事情......从左到右:
$('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.我建议在 CSS 中使用
top:
和right:
而不是top:
和left:
设置元素的 position,因此当它增长时,右侧保持在同一个位置。
there is a similar query on this that you can find here: jQuery slide left and show你可以在这里找到一个类似的查询: jQuery slide left and show
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.