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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:59:57+00:00 2026-05-22T19:59:57+00:00

I have two examples on jsFiddle: http://jsfiddle.net/9uhfX/1/ http://jsfiddle.net/9uhfX/2/ Example 1 In the first one

  • 0

I have two examples on jsFiddle:

  • http://jsfiddle.net/9uhfX/1/
  • http://jsfiddle.net/9uhfX/2/

Example 1

In the first one I can move the list elements around, even from a child element to the root element. However, it’s not very easy to make it “snap”.

Example 2

In the second example I have floated the list elements. This time I can’t get them to “snap” to the child elements.

Questions

  • Is there a good way to make it easier to snap?
  • How do I solve it with float?
  • 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-22T19:59:58+00:00Added an answer on May 22, 2026 at 7:59 pm

    There is a so far undocumented option in jQuery sortable to define the element against which tolerance is checked: toleranceElement. If not set, the whole item is checked for placement (including the nested list), but if it’s set, only sub-items matching the selector are taken into account.

    This means you have to change your HTML markup a bit to wrap the main content of the list item (the item text in your case) in an element and use that to check for sort positioning. That will leave out the nested <ul>s, effectively stopping jittering which is otherwise quite serious.

    HTML:

    <div id="example5"> 
        <ul> 
            <li ><div>Item 1</div>
                <ul> 
                    <li ><div>Item 1 1</div><ul></ul></li> 
                    <li ><div>Item 1 2</div><ul></ul></li> 
                    <li ><div>Item 1 3</div><ul></ul></li> 
                </ul> 
            </li> 
            <li ><div>Item 2</div><ul></ul></li> 
            <li ><div>Item 3</div><ul></ul></li> 
            <li ><div>Item 4</div><ul></ul></li> 
        </ul> 
    </div> 
    

    Javascript:

    $("#example5 ul").sortable({
        connectWith: "#example5 ul",
        placeholder: "ui-state-highlight",
        toleranceElement: 'div'
    });
    

    Try your modified demos here and here.

    You might also want to play with opacity, cursorAt and tolerance. Have a look at the documentation.

    Note that it’s not a perfect solution, in case you’re not satisfied with the results, have a look at using a plugin. Manuele J Sarfatti’s nestedSortable plugin looks like something that might be of use for you: http://mjsarfatti.com/sandbox/nestedSortable/

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

Sidebar

Related Questions

Code example: http://jsfiddle.net/MhEPw/1/ I have two jQuery Deferred objects. I want to have more
Example: I have two shared objects (same should apply to .dlls). The first shared
I have two websites, let's say they're example.com and anotherexample.net . On anotherexample.net/page.html ,
I have two List's which I want to check for corresponding numbers. for example
I have seen the following two examples of starting activities in Android: Example 1
I have two g:textfields in the first one I should write a number lets
jsFiddle In this example the two quotes both have the same width. What I
I have two arrays of animals (for example). $array = array( array( 'id' =>
Simplified for example, I have two tables, groups and items . items ( id,
For example if I have an Enum with two cases, does it make take

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.