2012-06-19 198 views
0

我想知道是否有一种方法来为div创建动画(箭头的图像),以便它出现在页面中间,然后指向我想要的任何对象(旋转朝向它)并朝它迈进。显示某物的位置。使用jQuery/javascript对象位置动画

是jQuery能够这样的动画,还是我应该看看其他库?

回答

0

是的jQuery的是能够提供这种类型的动画,你可以使用jQuery的.animate()方法动画。 http://docs.jquery.com/Effects/animate

箭头应该移动的代码(它的目标位置)放在那个方法.animate中。 例如。在.animate方法使用它

$('#arrow').css({ 
'-moz-transform':'rotate(80deg)', 
'-webkit-transform':'rotate(80deg)', 
'-o-transform':'rotate(80deg)', 
'-ms-transform':'rotate(80deg)' 
}); 

有例子可用于旋转,

live rotate and other css demo brillian http://css3please.com/

http://www.zachstronaut.com/posts/2009/02/17/animate-css-transforms-firefox-webkit.html

+0

但是,这只是用于定位,不旋转。 – Thomas

+0

这也可以使用'旋转'在CSS中,看到我编辑的答案 –