开发者

jQuery animate from random position

开发者 https://www.devze.com 2023-03-18 20:16 出处:网络
I have a series of panels that I\'d like to animate from random positions with jQuery. Basically, I want a series of panels with random \'top\', \'right\', \'bottom\', \'left\' propertie开发者_如何转

I have a series of panels that I'd like to animate from random positions with jQuery.

Basically, I want a series of panels with random 'top', 'right', 'bottom', 'left' propertie开发者_如何转开发s. In effect, I want some panels to slide in from the top, some from the left etc.

I've made a start, but am struggling to figure out how I'd go about getting the current elements css position property, i.e. top, bottom, left or right. Bear in mind I want the property, not the value.

Any ideas how I could achieve this?


jQuery's .animate() does not require you to know the current position of an element. You provide a map of CSS properties the element will move toward, and .animate() handles the rest.

0

精彩评论

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