从右到左调整jquery中的div [英] Resize div in jquery from right to left

查看:121
本文介绍了从右到左调整jquery中的div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想要从右到左设置动画并调整div标签

默认情况下,我从示例中了解到并调整了大小从左到右,但根据项目要求,我们希望从右到左的顺序。

By default i have learnt from examples and found it resizes from left to right but as per project requirement we wish to have it in right to left order.

我写的代码是:

<script type="text/javascript"> 
$(document).ready(function()
{
   $("button").click(function()
   {
      $("div#div1").animate({height:166},5000);
      $("div#div1").animate({width:800},5000);
   });
});
</script> 

<div id="div1" style="background:url(stripes.JPG);height:0px;width:0px;position:relative;" hidden="hidden">

这适用于从左到右的动画;请建议类似的方法,div将从右向左调整大小。

This works well in left to right animation; please suggest similar approach where the div will resize from right to left.

提前致谢。

推荐答案

这都是你的CSS的问题。让你的动画元素包含在位置:relative 元素,并将其CSS设置为 position:absolute;底部:0;右:0; 。然后,您将以所需方向显示动画。请参阅: http://jsfiddle.net/9SJ4Q/

It's all a matter of your CSS. Have your animated element wrapped in a position:relative element, and set its CSS to position: absolute; bottom: 0; right: 0;. Then youre animation will be displayed in the desired direction. See: http://jsfiddle.net/9SJ4Q/

这篇关于从右到左调整jquery中的div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆