2009
12.08

Reversing elements in jQuery

I made a fade in/out gallery using jquery.  And images are positioned as absolute,  so the last image element is always on top.  And my solution to make the first element on top is this.

Code:

var elements = $(‘.imagetransition’).get().reverse();

$(‘#gallerycontainer’).html(”).append(elements);


Explanation :  get() will return the array elements of $(‘.imagetransition’), and reverse() is a method of an array object.

Reversing elements in jQuery

No Comment.

Add Your Comment