Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

moving elements with jquery

Tags:

jquery

How can I use jQuery to move an element from:

position: absolute;
left: 169px;
top: 182px;

to:

position: absolute;
left: 169px;
top: 230px;

with clear moving so not just css, it has to be moving.

Thanks.

like image 674
med Avatar asked Feb 15 '11 00:02

med


People also ask

How do you move an element into another element?

Answer: Use the jQuery . appendTo() Method You can use the jQuery . appendTo() method to move an element into another element.

How do I move a div to a different div?

You can use the CSS position property in combination with the z-index property to overlay an individual div over another div element. The z-index property determines the stacking order for positioned elements (i.e. elements whose position value is one of absolute , fixed , or relative ).

How do you move an element in JavaScript?

In plain JavaScript, you can use the appendChild() method to move the existing source element in the document to the target element.


1 Answers

http://api.jquery.com/animate/

Demo: http://jsfiddle.net/pHwMK/

JS:

$(function() {
  $("div.ele").animate({ top: '230px' });
});
like image 186
simshaun Avatar answered Sep 21 '22 10:09

simshaun