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

  • Home
  • SEARCH
  • 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 6004243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T01:14:10+00:00 2026-05-23T01:14:10+00:00

I have a problem with the jquery sortable plugin. Indeed, I have items (questions)

  • 0

I have a problem with the jquery sortable plugin. Indeed, I have items (questions) which use both accordion and sortable.

I use the update event of sortable to show extra content in each question accordion.

But my problem is that after sorting the questions, the accordion of the one I moved opens itself automatically.

Here is a simple example which reproduces the problem : http://jsfiddle.net/JwzH2/1/

Try to sort the questions, and you’ll see the accordion opening itself (it might work correctly sometimes, so try again).

Do someone have an idea on how to fix it ?

EDIT : Fosco gave me a partially working solution, but there is still a problem => it does not work on dynamically added elements (see my comments on his answer).

Moreover, I am still astonished seeing the code working without this line : $('.hidden-content', question).show();. Indeed, the event propagation should be the same with and without this line

http://jsfiddle.net/JwzH2/38/

  • 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-23T01:14:11+00:00Added an answer on May 23, 2026 at 1:14 am

    I believe your answer lies here in the sample code from jQuery UI: http://jqueryui.com/demos/accordion/sortable.html

    $(function() {
        var stop = false;
        $( "#accordion h3" ).click(function( event ) {
            if ( stop ) {
                event.stopImmediatePropagation();
                event.preventDefault();
                stop = false;
            }
        });
        $( "#accordion" )
            .accordion({
                header: "> div > h3"
            })
            .sortable({
                axis: "y",
                handle: "h3",
                stop: function() {
                    stop = true;
                }
            });
    });
    </script> 
    

    Notice the use of a stop variable, and how it is caught and manipulated by both the sorting mechanism and the click handler.

    Edit: I spent a bit of time this morning playing with your dynamic content issue and here’s what I came up with. When a new item is added, I destroy and re-set the accordion and the appropriate click handlers. I moved the click handler setup and the accordion setup into functions, and call them initially and when a new item is added. It happens so quick that I don’t see any flicker or visual problems, but your mileage may vary. Give it a shot here: http://jsfiddle.net/JwzH2/41/

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

Sidebar

Related Questions

I have found a problem with use JQuery timeout, i have a page with
I have a problem with a jQuery UI 1.7.2 sortable list in Firefox 3.6,
I have a table that I've made sortable using the jQuery plugin Tablesorter 2.0
I'm working with a demo of two sortable jquery lists... but have a problem
I have the following ListView in which I am using the JQuery UI sortable
I have downloaded the jQuery outside events plugin as Sarfraz suggested, which seems really
I have a problem with the jquery-ui dialog box . The problem is that
I have a problem in integrating PHP and JQuery: My main file is MyFile.html
I am trying to send a jquery sortable list of items to my MVC
If I do jquery sortable on a contenteditable items, the item would never be

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.