Displaying 1 result from an estimated 1 matches for "switchpositionswithdom".
2007 Jul 31
6
Using Effect.Move() while maintaining the elements DOM order
...attrs), this
works quite well too, but what I''d like is
to change the elements position as well.
Consider the following example:
html:
...
<div id="a">First</div>
<div id="b">Second</div>
...
JS:
// switch two divs positions using DOM
function switchPositionsWithDOM(first, second) {
var parentElem = first.up();
var secondId = second.id;
var s = second.remove();
parentElem.insertBefore(s, first);
}
// switch positions using Effect.Move
function switchPositionsWithMove(first, second) {
var delta = Position.cumulativeOffset(first)[1] -
Positi...