Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#7368 closed enhancement (invalid)

Set index with index(number)

Reported by: anonymous Owned by: anonymous
Priority: undecided Milestone: 1.5
Component: core Version:
Keywords: Cc:
Blocked by: Blocking:

Description

It would be nice if the index() method allowed you to set the index of the current element(s) also; currently you can only get the index of the first element relative to its siblings. index(0) would move all the elements before their siblings and index(-1) would move all elements after their siblings. And it would be even better if it wrapped, so that if there's three elements and you did index(3), it would place the element at the start.

Change History (5)

comment:1 Changed 10 years ago by Rick Waldron

Owner: set to anonymous
Status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a jsFiddle that outlines practical use cases for your enhancement request.

Additionally, test against the jQuery 0 GIT version to ensure the issue still exists. Be Excellent to eachother!

comment:2 Changed 10 years ago by Rick Waldron

Component: unfiledcore

comment:3 Changed 10 years ago by anonymous

Status: pendingnew

Here's a simple example with jsFiddle of how you could use this to easily be able to move elements with a couple of controls. http://jsfiddle.net/Pzpzr/

I will work on additional usage examples soon if this one isn't sufficient enough.

Thanks!

comment:4 Changed 10 years ago by snover

Status: newpending

You can already do this very easily using .next, .previous, .after, and .before, as per this example. Could you please provide a novel use case?

comment:5 Changed 10 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Automatically closed due to 14 days of inactivity.

Note: See TracTickets for help on using tickets.