Bug Tracker

Modify

Ticket #7368 (closed enhancement: invalid)

Opened 3 years ago

Last modified 15 months ago

Set index with index(number)

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

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

comment:1 Changed 3 years ago by rwaldron

  • Owner set to anonymous
  • Status changed from new to pending

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 3 years ago by rwaldron

  • Component changed from unfiled to core

comment:3 Changed 3 years ago by anonymous

  • Status changed from pending to new

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 3 years ago by snover

  • Status changed from new to pending

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 2 years ago by trac-o-bot

  • Status changed from pending to closed
  • Resolution set to invalid

Automatically closed due to 14 days of inactivity.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.