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

  • Home
  • SEARCH
  • 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 8988881
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:07:07+00:00 2026-06-15T22:07:07+00:00

I would like to have an image which changes into three images when the

  • 0

I would like to have an image which changes into three images when the mouse is moved to the left and right of it.

  • Left to show the left arrow when the cursor is on the left side
  • Center to show the up arrow when the cursor is in the center
  • Right to show the right arrow when the cursor is on the right side

I found a jQuery script that works well. I edited it a bit and got it to display the left and right arrows when the mouse was moved. I just have the center part left to do and am not sure how to add that.

Here is what I have. (See also jsFiddle page: http://jsfiddle.net/WhkJB/ )

var image_src = {
    left: "http://i.imgur.com/ubKrq.jpg",
    right: "http://i.imgur.com/SxHCS.jpg",
};

$(document).mousemove(function(event){
    var mloc = {
        x: event.pageX,
        y: event.pageY
    };

    if( 
        (mloc.x >= 0 && mloc.x <= $(document).width()/2 )
    ){
        $(".arrow").attr("src", image_src.left);
    }else if( 
        (mloc.x >= $(document).width()/2 && mloc.x <= $(document).width()) &&
        (mloc.y >= 0 && mloc.y <= $(document).height()/2)
    ){
        $(".arrow").attr("src", image_src.right);
    }

});​

Another question – When you move the mouse below the image it doesn’t work. Is there anyway to make it so it does it so it moves on the whole page?

Any help would be greatly appreciated.

  • 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-15T22:07:09+00:00Added an answer on June 15, 2026 at 10:07 pm

    You can first calculate the X position percentage and then apply a simple if against it.

    i.e.:

    var image_src = {
        left: "http://i.imgur.com/ubKrq.jpg",
        right: "http://i.imgur.com/SxHCS.jpg",
        up: "http://i.imgur.com/SxHCS.jpg" // replace with UP image
    };
    
    $(document).mousemove(function(event){
        var xPercent = (event.pageX / $(document).width()) * 100;
        if(xPercent <= 40) { // show left
            $(".arrow").attr("src", image_src.left);
        }
        else if(xPercent >= 60) { // show right
            $(".arrow").attr("src", image_src.right);
        }
        else { // show up
            $(".arrow").attr("src", image_src.up);
        }
    });​​​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an array of integers which represent a RGB image and would like
I have two images which i would like to compare and do different operations
I have a div which contains a number of images. I would like to
I have an image in WPF that I would like to have display different
I would like to have a table header that looks like the image shown
I have an image within a popup that I would like to be swapped
I would like to have an AppWidget that designed like this one . Image:
I have an image. I would like to go over that image, pixel by
I have an image on my website. I would like when I click it,
how can I do this? I have an image 50x50 and I would like

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.