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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:49:05+00:00 2026-06-09T19:49:05+00:00

This has probably been asked already, but I was not able to find any

  • 0

This has probably been asked already, but I was not able to find any fix for what I am trying to do.

I am trying to find the magical combination of properties on the event object, along with scrolling and other offsets, to give me the position of an element relative to the top-most window that may or may not exist within an iframe. I am doing this in an attempt to fade in a small (absolutely positioned) image to the right of the element that is being moused over.

I am trying to get the position inside of a jQuery hover event. I have tried different combinations of the following properties:

$(element).position()
$(element).offset()
$(element).scrollTop()
$(element).scrollLeft();
$(document).scrollTop();
$(document).scrollLeft();
event.clientX
event.clientY
event.pageX
event.pageY

Does anyone have a function or equation that can give these numbers?

  • 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-09T19:49:07+00:00Added an answer on June 9, 2026 at 7:49 pm

    I’ve managed to finagle some code that worked for this situation. Hope this helps someone in the future:

    var timeoutID;
    $(element).hover(function () {
        // cancel any pending fades
        window.clearTimeout(timeoutID);
    
        var offset = {
            left: 0,
            top: 0
        };
    
        if (top !== self) {
            offset = top.$('#divContainingIframes').offset();
        }
    
        var that = $(this);
        var elementPosition = that.position();
    
        var xCoord = offset.left + // distance between screen and iframe
            elementPosition.left + // distance between iframe and element
            that.width() + // width of the element
            5; // 5 pixel padding
    
        var yCoord = offset.top + // distance between screen and iframe
            elementPosition.top; // distance between iframe and element
    
        // call the show function with xCoord and yCoord
    }, function () {
        // don't fade immediately, wait a half second
        timeoutID = setTimeout(function () {
            // call some hide function
        }, 500);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this has probably been asked before, but I haven't been able to find any
This has probably been asked before but I can't find any relevant post using
I realize this question has probably been asked numerous times, but I have not
This has probably been answer already but I am trying to return the primary
I am sure this has been asked already, but I have been trying all
This has probably been asked before on SO, but I was unable to find
This has probably been asked before, but I can't find a good way of
I know this has probably been asked before, but I can't find it with
This has probably been asked already - if so sorry! I couldn't find it.
I think this has probably been asked, but after reading a lot, I'm not

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.