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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:07:54+00:00 2026-06-11T20:07:54+00:00

The issue is with the following piece of code and i am not able

  • 0

The issue is with the following piece of code and i am not able to figure it out why? The code goeas as this way

.ASPX

 <cc1:TabPanel runat="server" HeaderText="Floor Plan" ID="TabPanelFloorPlan">
        <ContentTemplate>
                        <div id="floorplanContainer">
                        <img id='fplan' src="~/_layouts/card.jpg" usemap="#MyImageMap" />
                        </div>
                        <map id="MyImageMap" name="MyImageMap">
                            <area id='roomArea' shape="poly" coords="0,0,0,0" alt="Meeting Room" />
                        </map>
                        <input id="Submit" type="button" value="Draw" />
                        <input id="clear" type="button" value="Clear" />
        </ContentTemplate>
    </cc1:TabPanel>

Jquery

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script>
   
<script src="../../Style Library/Styles/jquery.maphilight.js" type="text/javascript"></script>
    <script>
        jQuery(document).ready(function () {
            var points = "";

            $("#floorplanContainer").click(function (e) {
                var x = e.pageX - this.offsetLeft;
                var y = e.pageY - this.offsetTop;

                var pwidth = 2;
                var pheight = 2;

                $("#floorplanContainer").append("<div class='point' style='font-size:0;position:absolute; display:inline; border: 1px solid black; top:" + (y - (pheight / 2)) + "px; left:" + (x - (pwidth / 2)) + "px; width: " + pwidth + "px; height: " + pheight + "px; z-index:100; '> </div>");
                if (points != "") points += ',';
                points += x + "," + y
            });

            $("#clear").click(function () {

                $('.point').remove();
                points = "";
                $('#roomArea').attr('coords', '0,0,0,0');
                $('#fplan').maphilight({ alwaysOn: false });

            });

            $("#Submit").click(function () {

                $('#roomArea').attr('coords', points);
                $('#fplan').maphilight({ alwaysOn: true });

            });
        })
</script>

The issue is as shown in the figure: The points get plotted at some other location on click seems like its plotting with respect to some other container and than the region is shifted at the bottom. Take a look.

enter image description here

I am not able to figure out whys this is happening can anyone help me to sort out the problem?

  • 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-06-11T20:07:55+00:00Added an answer on June 11, 2026 at 8:07 pm

    I think by using the jquery clientX and clientY properties of the mouse event object, you should get the coordinates from within the viewport. It might be usefull to put the imagemap in a container element.

    Two other properties may come in handy: parentX and parentY of the mouse event object. They return the coordinates measured from the top left corner of the screen.

    EDIT: clientX and clientY may not be the correct solution. But this answer seems to have a solution: jQuery get mouse position within an element

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

Sidebar

Related Questions

The following code is a simplified example of an issue I am seeing. This
The following issue popped up in my open source library, and I can't figure
The following piece of code was given to us from our instructor so we
I have the following piece of code: public interface Segment<T> extends Period { ...
I have a piece of code which works in a way that is unexpected
I am using the following piece of code to populate my ListView - setListAdapter(new
I am getting a strange error message with the following piece of PHP code
I have defined the following piece of Coffeescript code below, which defines a function
Consider the following piece of code: HTML: <div> <img src=http://placehold.it/600x150 /> </div> CSS: div
I have the following piece of code: void func() { try { f1() }

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.