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

The Archive Base Latest Questions

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

I am attempting to use JQuery to animate an image to the point where

  • 0

I am attempting to use JQuery to animate an image to the point where I click my mouse on a div.

The div of the html has an id of “stage” and the image has an id of “player”. I have successfully gotten the header to update when the user clicks on the stage, but once I add in the other JQuery to have the image move to my mouseclick on the stage, neither works.

Perhaps its something obvious since I’m new at JQuery but hopefully someone can spot my error.

Here’s my code for the JQuery:

$(document).ready(function(){
//alert('It works');
    $('#stage').click(function() {
        $('#header').html('Image is moving!');
    });

    $('#stage').click(function(e){
        $('#player').animate({
            top: e.pageY + 'px';
            left: e.pageX + 'px';
         }, 800);
    });
});

In summary, when someone clicks in the stage div the header above it should change, and the image should move to where the person clicked on the stage.

  • 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:45:38+00:00Added an answer on June 11, 2026 at 8:45 pm

    Two things:

    $('#player').animate({
        top: e.pageY + 'px';
        left: e.pageX + 'px';
    }, 800);
    

    Has syntax errors. It should be:

    $('#player').animate({
        top: e.pageY,
        left: e.pageX
    }, 800);
    

    Notice I left off 'px' since it isn’t necessary.

    You can see it working here: http://jsfiddle.net/VBzUw/

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

Sidebar

Related Questions

I am attempting to use AJAX in jQuery to load content to a div,
I'm attempting to use JQuery to create a dynamic page header using an image
I am attempting to use the .clone() in jquery. I have a $.post retuning
In my MVC view (using VS 2012 RC), I'm attempting to use jQuery to
I am attempting to use a Jquery menu, that makes use of the 'easeOutBounce'
I'm attempting to use the jQuery jFeed plugin for parsing an Atom, GeoRSS feed
I am attempting to use a jquery drowndown checklist control. Following some simple examples,
I am new to jQuery and attempting to use the dropdownchecklist control I am
I am attempting to use livequery. I unfortunately am stuck using jquery 1.2.6. This
I'm trying to use bassistance jquery tooltip - http://jquery.bassistance.de/tooltip/demo/ and I am attempting to

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.