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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:19:58+00:00 2026-05-22T14:19:58+00:00

I am trying to position my Div wherever the user clicks on my Image.

  • 0

I am trying to position my Div wherever the user clicks on my Image.

test is my Div, and myimg is my image.

Here is my JS:

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
  $("#myimg").click(function(e){
                             $("#test").show(2000);
                             $("#test").offset({left:e.pageX,top:e.pageY});

                             })
})
</script>

However that does not work. Can anyone tell me what I am doing wrong?

Edit: Sorry, I forgot to mention that the Div wont show up, if I include the offset line, if I dont, it shows, but not at the right position.

Here is the full code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xSky Software - Most likely the only software on Clickbank that exists.</title>
<link href="style.css" rel="stylesheet" type="text/css" /> 
<script type='text/javascript' src='video/jwplayer.js'></script>

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("#myimg").click(function(e){
                             $("#test").show(2000);
                             $("#test").offset({left:e.pageX,top:e.pageY});

                             })
})
</script>


</head>
<body>
    <!--Header and Logo-->
    <div id="header">
            <div id='mainvid'>This text will be replaced</div> 
            <script type='text/javascript'>
              jwplayer('mainvid').setup({
                'flashplayer': 'video/player.swf',
                'file': 'video/Untitled1.mp4',
                'controlbar': 'none',
                'frontcolor': 'FFFFFF',
                'lightcolor': 'FFFFFF',
                'screencolor': 'FFFFFF',
                'autostart': 'true',
                'width': '709',
                'height': '422'
              });
            </script>            
            </div>   
    </div>


    <div id="test" style="width:100px; position:absolute; display:none; height:100px; border:#093 solid 2px; background:#0C6;">
    Teeest
    </div>

    <!--Content-->
    <div id="content">            
        <center><img src="Images/downloadbutton.png" id="myimg" /></center>   
        <br />
        <div class="text">
        OH YEAH!
        </div> 
    </div>



    <!--Footer-->
    <div id="footer">

    </div>

</body>
</html>
  • 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-22T14:19:59+00:00Added an answer on May 22, 2026 at 2:19 pm

    It seems to work fine. I have set up a JSFiddle for you:

    http://jsfiddle.net/JPvya/

    Click on the image and the test div moves. The only change is using the $ short notation for JQuery instead of typing “JQuery” which, by the way is probably case sensetive and causing the problem!

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

Sidebar

Related Questions

im trying to position a div relative to an image element. problem is, the
I have a div element that I'm trying, basically, to move wherever the user
I'm trying to have an image inside of a position:fixed div respond to the
I'm having a problem trying to position a div in my web page, here's
I'm trying to run some conditional javascript to position a div such that, if
<style type=text/css> div.imageSub { position: relative; } div.imageSub img { z-index: 1; } div.imageSub
I'm trying to position a div inside a div. the outer div has a
I am trying to position an overlay over a div. I had the code
I am trying to make a div slide to a FIXED position on the
I'm trying to set the caret position in a contenteditable div layer, and after

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.