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 9174439
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:45:26+00:00 2026-06-17T16:45:26+00:00

I want to create a sortable image gallery using Jquery UI Sortable. Until here,

  • 0

I want to create a sortable image gallery using Jquery UI Sortable. Until here, works fine.

Inside each tag, I need to store the order of each image in the gallery. But this order must be updated when an image is moved.

Example: I have five images:

<ul id="sortable">
  <li id="1" value="1">image 1</li>
  <li id="2" value="2">image 2</li>
  <li id="3" value="3">image 3</li>
  <li id="4" value="4">image 4</li>
  <li id="5" value="5">image 5</li>
</ul>

If I move the image 4 after image 5, the order values ​​should not be changed. That is, the image 5 has the value 4 and the image 4 has the value 5.

This is possible?

  • 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-06-17T16:45:27+00:00Added an answer on June 17, 2026 at 4:45 pm

    You could update the value in the event stop when the sort just ends. Something like this :

    $("#sortable").sortable({
        stop: function(event, ui) {
            $(this).children("li").each(function(index) {
                $(this).attr("value", index);
            });
        }
    });
    

    Like this, you can save the new values on the server if you want to keep this display after a reload.

    EDIT: correcting the way to set index thanks to marcelo2605

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

Sidebar

Related Questions

I'm trying to create a sortable list using the Jquery sortable plugin. I want
I'm using jQuery UI's sortable and I want the by the user sorted list
I want to create a table that is sortable using the attributes of a
I'm using jQueryUI to create a large table of sortable cards, each of which
I'm trying to create a paginated, sortable datatable using MyFaces . The sorting works
I am using the JQuery.Sortable() function to create a reorderable list of items like
I want to create a resizable grid, filled with draggable and sortable icons (similar
i want create Dynamic Slideshow in Jquery i'm Write this code var ctx =
i want create image animation , i have 50 images with png format now
I have multiple images stored at URLs like: /uploads/hash/IMAGE001.jpg . Using jQuery UI's sortable()

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.