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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:25:08+00:00 2026-05-27T09:25:08+00:00

Box bordered in Red is my Droppable div area. which is having image set

  • 0

This is my HTML output look like

Box bordered in Red is my Droppable div area. which is having image set as background

Box bordered in Blue is my Draggable div Area which contains pointer pin image which can be dropped to droppable region

one of Dropped pointer is shown by Black Arrow

Here is code

<body>
<div id="Droppable" class="ui-ui-corner-all">
    Drop Area</div>
<div id="Draggable" class="ui-ui-corner-all">
    <img class="draggableItem" id="Item1" src="Images/pointer.png" alt="" />
    <div class="draggableItem" id="Item2">
        <img src="Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item3">
        <img src="Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item4">
        <img src="Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item5">
        <img src="Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item6">
        <img src="Images/pointer.png" alt="" />
    </div>
</div>

I want to achieve following functionality.

1) User can drop Pointer pin on Droppable region.

2) Once a Pointer pin is dropped on Droppable region I will read Pointer pin’s Left Top position using jQuery function .position

3) Then those Left and Top Value I am storing in Database by making jQuery ajax call.

4) Then another page get all pointer position from the DB and show those pointer on the same image where the Pointer were dropped.

Issue Facing

When I read all pointer position from the Database and show those pointer on the image with respective Left Top position

Pointer is not get placed where it was dropped

Now the code for both page are same means I render pointer position on the same page where it was dropped.

its showing as following Image

enter image description here

Javscript code

    $(document).ready(function () {
        $(".draggableItem").draggable();


        $("#Droppable").droppable({
            drop: function (event, ui) {
                //my business logic
                 var droppablesPos = //Read dropped item postion using  jQuery .position()


              $.ajax({
                type: "POST",
                url: "/Feature/SavePointer",
                datatype: "json",
                traditional: true,
                data: { "Left": droppablesPos.Left, "Top": droppablesPos.Top},
                success: function (result) {
                    //return message to user

                },
                error: function (req, status, error) { }
            }
            }

        });

    });

Code is very complex I am posting sample to get and Idea

Here is all code javascript

<script type="text/javascript">
$(document).ready(function () {
    $(".draggableItem").draggable();
    var droppablesPos = $("#Droppable").position();
    var dr = $("#Droppable").offset();

    alert("pos Left:" + droppablesPos.left + " " + "Top:" + droppablesPos.top);
    alert(" offest Left:" + dr.left + " " + "Top:" + dr.top);
    $("#Droppable").droppable({
        drop: function (event, ui) {
            $("#" + ui.draggable.attr("id").toString() + "").addClass("droppedItemClickable");


        }

    });

    $(".draggableItem").click(function () {
        var titleName = $(this).attr("id");
        var droppedItemPosition = $(this).offset();
        if ($(this).is(".droppedItemClickable")) {
            $("#dailog").dialog({ width: 480, height: 400, title: titleName });
            $("#FeatureId").val(titleName);
            $("#FeatureTopPosition").val(droppedItemPosition.top);
            $("#FeatureLeftPosition").val(droppedItemPosition.left);
        }
    });

    $("#featureSubmit").click(function () {
        var FeatureId = "1";
        var FeatureName = $("#featureName").val();
        var FeatureDescription = $("#featureDescription").val();

        $.ajax({
            type: "POST",
            url: "/Builder/SaveFeature",
            datatype: "json",
            traditional: true,
            data: { "featureId": FeatureId, "featureName": FeatureName, "featureDescription": FeatureDescription },
            success: function (result) {
                alert(result);

                $(control).val(result.toString());
            },
            error: function (req, status, error) { }
        }
        );
        alert("Feature Submited Successfully...");
        $("#dailog").dialog("close");
    });

    $("#featureCancel").click(function () {
        $("#dailog").dialog("close");
    });
    function ret()
    { return false; }

});

and HTML

 <div id="Droppable" class="ui-ui-corner-all">
    Drop Area</div>

<div id="Draggable" class="ui-ui-corner-all">
    <img class="draggableItem" id="Item1" src="../../Images/pointer.png" alt="" />
    <div class="draggableItem" id="Item2">
        <img src="../../Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item3">
        <img src="../../Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item4">
        <img src="../../Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item5">
        <img src="../../Images/pointer.png" alt="" />
    </div>
    <div class="draggableItem" id="Item6">
        <img src="../../Images/pointer.png" alt="" />
    </div>
</div>

<br />
<div id="dailog" class="hidden">
    <form method="post" action="/Builder/UploadFeature" enctype="multipart/form-data">
    <div class="editor-label">
        <%: Html.LabelFor(model => model.FeatureId) %>
    </div>
    <div class="editor-field">
        <%: Html.EditorFor(model => model.FeatureId)%>
        <%: Html.ValidationMessageFor(model => model.FeatureId)%>
    </div>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.FeatureName) %>
    </div>
    <div class="editor-field">
        <%: Html.EditorFor(model => model.FeatureName) %>
        <%: Html.ValidationMessageFor(model => model.FeatureName) %>
    </div>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.FeatureDesc) %>
    </div>
    <div class="editor-field">
        <%: Html.EditorFor(model => model.FeatureDesc) %>
        <%: Html.ValidationMessageFor(model => model.FeatureDesc) %>
    </div>
    <input type="file" name="ImageUploaded" />
    <div class="editor-label">
        <%: Html.LabelFor(model => model.FeatureLeftPosition)%>
    </div>
    <div class="editor-field">
        <%: Html.EditorFor(model => model.FeatureLeftPosition)%>
        <%: Html.ValidationMessageFor(model => model.FeatureLeftPosition)%>
    </div>
    <div class="editor-label">
        <%: Html.LabelFor(model => model.FeatureTopPosition)%>
    </div>
    <div class="editor-field">
        <%: Html.EditorFor(model => model.FeatureTopPosition)%>
        <%: Html.ValidationMessageFor(model => model.FeatureTopPosition)%>
    </div>
    <input type="submit" onclick="ret()" />
    </form>
</div>
  • 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-27T09:25:09+00:00Added an answer on May 27, 2026 at 9:25 am

    You should not get the position starting at the code which you did nothing. The draggable position is retrieved inside the drop event:

     options.drop = function (event, ui) {
          // ui here refers to the element being dropped
          var leftPosition = ui.offset.left;
          var topPosition = ui.offset.top;
     }
    

    Hope this help 🙂

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

Sidebar

Related Questions

See screenshot. The bounding cyan-bordered box is the button, while the blue fill is
Out of the box, in MS Reporting Services, the image element does not allow
I have a combo box on a WinForms app in which an item may
I have a dialog box that allows users to set hotkeys for use in
I have a FreeBSD box with Bash set up. I'm used to Debian Linux
$('.box').click(function(){ $(this).find('p').toggle( function () { $(this).css({color : red}); }, function () { $(this).css({color :
I have an input box and I have a span tag that contains some
box div will be hidden during pageload, when we hover on it it should
I have a select box, from which I want to remove selected choice with
Contact box in the footer the textarea and input boxes are in a div

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.