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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:35:59+00:00 2026-05-23T02:35:59+00:00

I have a page where a user has to drag items from an area

  • 0

I have a page where a user has to drag items from an area elsewhere on a screen.

When all items are dragged out — 100% task is accomplished.

I would like to calculate what % of the task is accomplished on each drag and drop (when an items is dragged out of gray area).

How do I count remaining items within an area?

How do I convert into percentages?

Shall I calculate what each item’s worth in terms of % on page load and then subtract?

  • 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-23T02:36:00+00:00Added an answer on May 23, 2026 at 2:36 am

    Based on Chris May’s comment, try this :

    var startCount = $("#launchPad .card").length;
    
    $(".stack").bind( "drop", function(event, ui) {
        var currentCount = startCount - $("#launchPad .card").length + 1;
        alert(currentCount / startCount * 100 + "%");
    });
    

    Here it starts since the first drop from 0% to 100%

    Fiddle here: http://jsfiddle.net/qQdZy/

    EDIT :
    This should fix the problem 🙂

    var startCount = $("#launchPad .card").length;
    
    $(".stack").bind( "drop", function(event, ui) {
        var currentCount = startCount - $("#launchPad .card").length;
        if (currentCount != startCount)
            currentCount++;
        alert(currentCount / startCount * 100 + "%");
    });
    

    New fiddle : http://jsfiddle.net/qQdZy/1/

    NEW EDIT :
    Ok, I have changed my solution. Here it works :

    var startCount = $("#launchPad .card").length;
    var moveFromLaunch = false;
    
    $(".card").bind( "dragstart", function(event, ui) {
      moveFromLaunch = true;
    });
    
    $(".stack").bind( "drop", function(event, ui) {
        var currentCount = $("#launchPad .card").length;
        if (moveFromLaunch)
            currentCount--;
        currentCount = startCount - currentCount;
        moveFromLaunch = false;
        alert(currentCount / startCount * 100 + "%");
    });
    

    Fiddle : http://jsfiddle.net/qQdZy/3/

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

Sidebar

Related Questions

I have a form on a page where the user has inputs to edit
I have a page that has a bunch of user controls on it. I
I have a complex page that has several user controls like galleries, maps, ads
I have a user profile page on my web app which has contact information.
I have a page that displays a list of users. each user has an
I have a page where the user can drag and drop objects and save
I have a drag-and-droppable control on my page. It has a client-side event 'OnClientDragging'
I have to create a sample silver-light page that has some user interactive elements
I have a page that lists users, each user has a profile image. The
I have one page form done with Spring MVC. User has to register first

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.