Sorting is similar to youtube home page

I am trying to achieve an effect similar to the youtube home page (you have to be logged in, so I posted a short movie to explain this ): we have a basic sort (only vertically), but on each item to be sorted, we have an up button "and" down ". These buttons do ... exactly what it says: move each element with a gentle animation motion or downward.

So, I think it works very much like sortable: it creates a helper (i.e. an animated element), then after the animation finishes, the DOM changes with new positions.

So, any idea is welcome!


I did a little test in firebug. I can clone an element like this:

$('.hslider:first').clone(true).insertAfter('.hslider:first')

      

But the main problem is that I have JS tied to elements inside .hslider

. Even though some of them work, others (like the jquery UI slider) don't. Is there a way to do this without reinitializing entire js? I tried to look at the jQuery jQuery source, but ... I'm not that good at js / jquery to be able to decode anything useful (yes, the source was uncompressed: P)


Edit:

I found something similar here , but I really don't want to download another 40kb + just for this effect (especially when I already have jQuery loaded)

0


a source to share


1 answer


Why don't you use the live () method available in jQuery 1.3+. This will ensure that your elements still have event bindings even after they are reinserted. Live basically binds js routines to all existing and future mapped elements. No additional download required;)



+1


a source







All Articles