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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:52:12+00:00 2026-05-26T07:52:12+00:00

I am trying to popup a div whenever a span with id toolpopup is

  • 0

I am trying to popup a div whenever a span with id toolpopup is clicked (div should appear at those coordinates) and it works fine for the spans which are at the top of the page. But when i scroll down and click the span the div is created but not at the desired coordinates. What could be possibly wrong? I am trying it on Firefox 7.0.1

$("#toolpopup").live("click", function(event) {
    var X = event.clientX;
    var Y = event.clientY;
    $("#popup").css('position', 'absolute');
    $("#popup").css("top", Y);
    $("#popup").css("left", X);
    $("#popup").css("display","block");
});
  • 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-26T07:52:12+00:00Added an answer on May 26, 2026 at 7:52 am

    I’m not sure that properly understand your task, but may be you need to append into X and Y a document scroll offset, because:

    MDN https://developer.mozilla.org/en/DOM/event.clientX:
    event.clientX

    Returns the horizontal coordinate within the application’s client area
    at which the event occurred

    In my code I get scroll offset as:

    var xOffset=Math.max(document.documentElement.scrollLeft,document.body.scrollLeft);
    var yOffset=Math.max(document.documentElement.scrollTop,document.body.scrollTop);
    

    Then you can set X and Y as:

    $("#toolpopup").live("click", function(ev) {
        var X = ev.clientX+xOffset;
        var Y = ev.clientY+yOffset;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a div element which shows some text as popup.
I am trying to build a simple div based popup which can be used
i am trying to display a popup-div below the mouse cursor, but it should
I'm trying to create a popup for which I am using jQuery's CSS function.Here's
How can I copy an entire div to a popup window? What I`m trying
I am trying to make a div popup next to the mouse when a
I have this php code, with which I am trying to generate a popup
Im trying to make a popup div (when a text-box value changes) and it
I'm trying to hide a div if the user clicks anywhere BUT the popup
I'm currently trying to use jQuery to fade a particular div which contains a

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.