Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7535125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:14:11+00:00 2026-05-30T06:14:11+00:00

I am looking for a method to have a JQuery-like sortable list ( link

  • 0

I am looking for a method to have a JQuery-like sortable list (link), but with some of the elements in fixed undraggable positions.

It’s trivial to make some elements undraggable, but their positions don’t remain fixed because the number of draggable elements above and below them can change.

To be more specific:
I have a list of 10 items in rank order. I want the user to be able to change the rank for some of the items by dragging (a la sortable list), but not change the rank of other frozen elements. The standard JQuery sortable undraggable feature allows the rank of frozen items to be changed by changing the number of elements above or below the frozen ones.

I’ve tried do this manually by “swapping” list elements when dragging. I.e., when a list element is dragged over a non-frozen element, the position of the two elements is swapped. This gives the semantics I want, but the item being dragged visibly “jumps” between its new position and the current ‘drag’ position. (I want it to remain in its current drag position; only its position in the DOM should change. But when the DOM position changes, the drag offset coordinates must be recomputed. And I don’t know how to do both the DOM position change and drag offset coordinate change atomically, preventing a redraw between the two. Currently, sometimes a redraw happens between the two, and the element visibly, albeit shortly, jumps.)

Edit
Here’s a jsfiddle showing my manual approach:
link. Play with it for a while and you’ll notice the flicker/jumping I mentioned.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T06:14:12+00:00Added an answer on May 30, 2026 at 6:14 am

    I’ve looked at your fiddle, had another think, and here’s one way to do it using sortable: on start store the fixed index positions in the data object of each fixed item, and then on any change, move the fixed items back into place.

    $(function() {   
        $('#rankings').sortable({
            axis: 'y',
            items: '.sortable',
            start: function () {
                $(this).find("li:not(.sortable)").each(function () {
                    $(this).data("fixedIndex", $(this).index());
                });
            },        
            change: function () {
                $(this).find("li:not(.sortable)").each(function () {
                    $(this).detach().insertAfter($("#rankings li:eq(" + ($(this).data("fixedIndex")-1) + ")"));
                });
            }
        });
    });
    

    Using a list such as:

    <ol id="rankings">
        <li class="sortable">Dog</li>
        <li class="">Cat</li>
        <li class="sortable">Parrot</li>
        <li class="sortable">Gerbil</li>
        <li class="sortable">Snake</li>
        <li class="">Goldfish</li>
    </ol>
    

    Seems to work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking into the jQuery UI Resizable method and I have to DIVs
I am looking to add functionality to a jQuery method. I have the code
I was looking at the Ruby logging library Logging.logger method and have a question
I am looking for a method to monitor a running program that I have
I am looking for a method of storing Application Messages, such as You have
I am looking for a fairly simple image comparison method in AS3. I have
I'm looking for some help converting this from prototype to jQuery. I'm doing some
I've just started looking at JQuery. I don't have any AJAX in my web
I have an ASP.NET webservice method that returns a generics list (List'<'Construct>) serialized as
I have a list of Child objects. I would like to be able to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.