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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:08:07+00:00 2026-05-27T02:08:07+00:00

So I have a div and I added a background image via CSS. I

  • 0

So I have a div and I added a background image via CSS. I want the image to animate to a different position on hover with jQuery.

I have everything working except for the animation is not firing. To simplify the code, I created an example of my scenario here.

Here is the HTML:

<div class="moveMe"></div>

The CSS:

div.moveMe {
    margin: 20px auto;
    width: 100px;
    height: 200px;
    border-radius: 7px;
    box-shadow: #000 0 0 6px;
    cursor: pointer;
    background: url('http://placekitten.com/200/300')no-repeat 0px 0px;
}

And the problem, the jQuery:

 $('.moveMe')
    .css( {backgroundPosition: "0% 0%"} )
    .hover(
        function() {
            $(this).stop().animate({backgroundPosition: "100% 0%"}, "600");
        },
        function() {
            $(this).stop().animate({backgroundPosition: "0% 0%"}, "600");
        });

just so you know:

  • jQuery is loaded
  • The jQuery code is inside of the document load function

I tried changing the animate properties to change the width on hover in out and it worked so I think my problem is with the backgroundPosition syntax or something.

This is driving me crazy, any help would be great.

  • 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-27T02:08:08+00:00Added an answer on May 27, 2026 at 2:08 am

    Check this: http://jsfiddle.net/9Y9Bv/3/

    I just switched to background-position-x

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

Sidebar

Related Questions

I have a script that switches background image on hover: $('div#example').hover(function(){ $(this).css('background',url('images/bg_2.png') no-repeat bottom);
I have an empty div called #lightPole that has a background image of a
I have a div tag styled through CSS. I set the padding to 10px
i have this jquery crossfade that is working for the most part except it
Im looking for a way to change the background image of a div using
I am creating a web page, where I have an image that I want
I'm using the CSS based rollover trick that switches the background position of the
I have recently added jQuery to a site of mine. When hovering over sections
I have a drop down menu that is coded in HTML, CSS, and jQuery
I have an image added as a CCK field. In a node tpl file

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.