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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:20:51+00:00 2026-05-29T09:20:51+00:00

Short version : How can I drag Link 1 into one of the dropdowns

  • 0

Short version: How can I drag Link 1 into one of the dropdowns under Link 3 in this demo? http://jsfiddle.net/Gdadu/2/

EDIT: The issue has been brought up about what should happen when an item is dragged over another: should it be placed to the left/right or start a new submenu? In order for the list to be fully sortable, there has to be some way to drop items into non-existing submenus, starting a new ul dropdown. I could insert an empty ul in every list item that doesn’t have one yet to serve as a drop target, but the problem above still exists.

This seems a lot more difficult than I initially thought, so I apologize for not having put more effort into this yet, as I hadn’t considered some of these problems. I’m willing to accept an answer to the stated issue and worry about the rest later.


I have a basic dropdown navigation list that I want to be fully sortable, using jQuery UI. Any li element should be able to move to any position in the entire list. I’m having trouble with dragging top level list items into submenus, it seems that :hover doesn’t trigger on the dropdown list while in “drag mode”, so the dropdowns don’t appear.

Example HTML:

<ul class="dropdown">
    <li><a href="#">Link 1</a></li>
    <li><a href="#">Link 2</a></li>
    <li><a href="#">Link 3</a>
        <ul>
            <li><a href="#">Link</a></li>
            <li><a href="#">Link</a></li>
            <li><a href="#">Link</a>
                 <ul>
                    <li><a href="#">Link</a></li>
                    <li><a href="#">Link</a></li>
                    <li><a href="#">Link</a></li>
                </ul>
            </li>
        </ul>
    </li>
</ul>

My CSS:

.dropdown,
.dropdown li,
.dropdown ul {
    list-style:none;
    margin:0;
    padding:0;
}
.dropdown {
    position:relative;
    display:block;
    z-index:10000;
}
.dropdown ul {
    position:absolute;
    top:100%;
    width:100%;
    visibility:hidden;
    display:none;
    z-index:900;
}
.dropdown ul ul {
    top:0;
    left:100%;
}
.dropdown li {
    position:relative;
    float:left;
}
.dropdown li:hover{
    z-index:910;
    cursor:default;
}
.dropdown ul:hover,
.dropdown li:hover > ul,
.dropdown a:hover + ul,
.dropdown a:focus + ul {
    visibility:visible;
    display:block;
}
.dropdown a {
    text-decoration:none;
    display:block;
    padding:.5em 2em;
    background:#cde;
    border:1px solid #ccc;
}
.dropdown ul li {
    width:100%;
}

Sortable initialization:

$('.dropdown').sortable({
    items: 'li'
});

Demo: http://jsfiddle.net/Gdadu/2/

For example, I want to drag “Link 1” into a submenu, but can’t do it because the submenu doesn’t appear while dragging, as if :hover is ignored. I’m not sure if the problem lies in the CSS or javascript. What can I do about this?

Good idea from the comments:

Perhaps you could trigger everything to expand when a drag starts

This would probably work, but I don’t want the entire menu to expand. It could be a lot of content with many links and 3 levels of navigation, and would probably overlap itself with all the flyouts/dropdowns (huge mess).

  • 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-29T09:20:51+00:00Added an answer on May 29, 2026 at 9:20 am

    Here is a fiddle that shows a few points that can help you with your implementation: http://jsfiddle.net/Gdadu/13/

    It is far from perfect, and as pointed out in the comment, there is a few logical problems also with “sorting everything everywhere” 🙂 Things not working here are sorting nested li’s back to top level, sortables on nested ul’s, … but I think they are sketched out there. Distinguishing the sorting from the dragging might be one thing necessairy with jqueryui’s current status. Also I shortcut your excellent css solution for the submenus and made them javascript based as to simplify things a bit.

    But: You can drop link1 inside link3 or link3’s nested ul 😉

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

Sidebar

Related Questions

The short version of the question - why can't I do this? I'm restricted
So the short version of this is: Can I traverse only the elements within
Short version: can you help me fill in this code? var conkeror_settings_dir = ".conkeror.mozdev.org/settings";
Inspired by this question . Short version: Why can't the compiler figure out the
Short version : How can an MFC ActiveX control loaded into a web page
Short version: What kind of escape sequence can one use to search for unicode
Short version: I need mysql code that will change [href=http://a-random-domain.com]hyperlink[/href] into <a href=http://a-random-domain.com>hyperlink</a> without
The short version of this question is: How can I take data that only
How can I download page on this link http://www.kayak.com/s/search/air?ai=kayaksample&do=y&ft=ow&ns=n&cb=e&pa=1&l1=ZAG&t1=a&df=dmy&d1=4/10/2010&depart_flex=exact&r1=y&l2=LON&t2=a&d2=11/10/2010&return_flex&r2=y Link changes to short version
Short version: How can I map two columns from table A and B if

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.