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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:23:21+00:00 2026-05-28T05:23:21+00:00

i have a requirement in which i have a container div that contains 3

  • 0

i have a requirement in which i have a container div that contains 3 <ul> on which dragsort is attached stucture is comething like

<div id="container">

    <ul id="list1">
        <li><div>a</div></li>
        <li><div>a</div></li>
        <li><div>a</div></li>
        <li><div>a</div></li>
    </ul>
    <ul id="list2">
        <li><div>b</div></li>
        <li><div>b</div></li>
        <li><div>b</div></li>
        <li><div>b</div></li>
    </ul>
    <ul id="list3">
        <li><div>c</div></li>
        <li><div>c</div></li>
        <li><div>c</div></li>
        <li><div>c</div></li>
    </ul>
</div>

Requirement:

these item are dragged & drop in between these lists . but item should not be taken out of the container div (visually not) is there any way to detach the mouse from the item when somone is trying to drag item out of the container div

like there is

containment: "#containment-wrapper" in jquery  .draggable(

reference: http://jqueryui.com/demos/draggable/#constrain-movement

  • 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-28T05:23:22+00:00Added an answer on May 28, 2026 at 5:23 am

    i want containment functionality in jquery dragsort plugin

    If you’re referring to jQuery List DragSort, it is coded to contain the dragged item within a container but only inside UL if you’re not dragging between lists. So to specify a custom container you will need to modify the code. So find this in the code:

    if (!opts.dragBetween) {
        var containerHeight = $(list.container).outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / $(list.container).outerWidth())) * list.draggedItem.outerHeight() : $(list.container).outerHeight();
        list.offsetLimit = $(list.container).offset();
        list.offsetLimit.right = list.offsetLimit.left + $(list.container).outerWidth() - list.draggedItem.outerWidth();
        list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
    }
    

    And replace with:

    if (!opts.dragBetween || typeof opts.containment != "undefined") {
        var box = typeof opts.containment != "undefined" ? $(opts.containment) : $(list.container);
        var containerHeight = box.outerHeight() == 0 ? Math.max(1, Math.round(0.5 + list.getItems().size() * list.draggedItem.outerWidth() / box.outerWidth())) * list.draggedItem.outerHeight() : box.outerHeight();
        list.offsetLimit = box.offset();
        list.offsetLimit.right = list.offsetLimit.left + box.outerWidth() - list.draggedItem.outerWidth();
        list.offsetLimit.bottom = list.offsetLimit.top + containerHeight - list.draggedItem.outerHeight();
    }
    

    Next find this:

    if (!opts.dragBetween) {
        top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
        left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
    }
    

    And replace with this:

    if (this.offsetLimit != null) {
        top = Math.min(this.offsetLimit.bottom, Math.max(top, this.offsetLimit.top));
        left = Math.min(this.offsetLimit.right, Math.max(left, this.offsetLimit.left));
    }
    

    Now invoke dragsort like this:

    $("#container ul").dragsort({ containment: "#container", dragBetween: true });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a requirement where the interface, which contains a video, is portrait only
I have a winform application which contains a window resizable but one requirement is
I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
I have a container div , inside which I want to pack a variable
Good day, I have a requirement which i need to include a layout (actually
I have a unique requirement which I need to meet to with sitecore, and
I have a data storage requirement which is an excellent candidate for single instance
I have a requirement to design a Web Application which acts as a Facade
I have a requirement on my current project (a Flex app which will be
I have a requirement to create a windows form control which has to detect

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.