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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T16:29:41+00:00 2026-05-12T16:29:41+00:00

hey I have been trying for hours and I don’t understand why the following

  • 0

hey I have been trying for hours and I don’t understand why the following does not work with IE but other works.
The problem that I’m having is the the background of the parent link, which is a span with an id assigned, does not animate the background image set via CSS. I get an error that says ‘Undefined’ is null or is not an object

$('a.inactive').click(function(self) {
        var parent = $(this).parent();
        if (parent.css('background-position-x')) {
            var pos = parseInt(parent.css('background-position-x').split(' ')[0]);
        } else {
            var pos = parseInt(parent.css('background-position').split(' ')[0]);
        };
        $.ajax({
           type: "GET",
           url: "somepage.php",
           data: "id="+parent.attr('id').replace('inactive-',''),
           complete: function(){
             //alert("Data Saved: ");
                if(pos < 0) {
                    parent.animate({backgroundPosition: '(0px 0px)'}, {duration:600});
                } else {
                    parent.animate({backgroundPosition: '(-39px 0px)'}, {duration:600});
                }

                //parent.attr('class',$(this).className.replace(/sprite-hover-(\w+)-off/gi,'active1') );
           },
           async: false
         });
    });

The Code below is from Alexander Farkas

(function(jQuery){
        $.extend($.fx.step,{
            backgroundPosition: function(fx) {
            if (fx.state === 0 && typeof fx.end == 'string') {
                var start = $.curCSS(fx.elem,'backgroundPosition');
                start = toArray(start);
                fx.start = [start[0],start[2]];
                var end = toArray(fx.end);
                fx.end = [end[0],end[2]];
                fx.unit = [end[1],end[3]];
                        }
            var nowPosX = [];
            nowPosX[0] = ((fx.end[0] - fx.start[0]) * fx.pos) + fx.start[0] + fx.unit[0];
            nowPosX[1] = ((fx.end[1] - fx.start[1]) * fx.pos) + fx.start[1] + fx.unit[1];          
            fx.elem.style.backgroundPosition = nowPosX[0]+' '+nowPosX[1];

           function toArray(strg){
               strg = strg.replace(/left|top/g,'0px');
               strg = strg.replace(/right|bottom/g,'100%');
               strg = strg.replace(/([0-9\.]+)(\s|\)|$)/g,"$1px$2");
               var res = strg.match(/(-?[0-9\.]+)(px|\%|em|pt)\s(-?[0-9\.]+)(px|\%|em|pt)/);
               return [parseFloat(res[1],10),res[2],parseFloat(res[3],10),res[4]];
           }
        }
        });
})(jQuery);
  • 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-12T16:29:41+00:00Added an answer on May 12, 2026 at 4:29 pm

    There is a new version of the backgroundPosition plugin that works with IE8 at least:

    http://plugins.jquery.com/project/backgroundPosition-Effect
    http://plugins.jquery.com/files/jquery.backgroundPosition.js_6.txt

    Demo: http://jsbin.com/evizu (Editable via http://jsbin.com/evizu/edit)

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

Sidebar

Related Questions

Hey, have been trying to work this out for last day or so but
Hey I have been trying to work on this for some time but I
Hey guys, I've been trying to play with mongoose & node, but I have
Hey all, i have been trying for a few minutes on this problem and
hey people I'm new at jquery and i have been trying to figure this
Hey all, I have been doing nothing but web development over the last few
Hey this might be a simple question, but i have been stumped on it
Hey I have downloaded one of the xml editors from some site. But don't
Hey guys i have been trying to download it from the below link http://www.enterprisedb.com/products-services-training/pgdownload
Hey guys so I have been trying to figure out why my update function

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.