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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:57:36+00:00 2026-06-10T06:57:36+00:00

This code is extension created by Alexander Farkas http://bit.ly/bZzOC8 It is usefull for could

  • 0

This code is extension created by Alexander Farkas http://bit.ly/bZzOC8
It is usefull for could used two values on the function animate() as in this example:

$('div').animate({
   backgroundPosition:'(0 -5500)'
},330);

Unfortunately this extension doesn’t work when use IE7 or IE8.
The next code is the backgroundPosition extension:

/**
 * @author Alexander Farkas
 * v. 1.02
 */
(function($) {
    $.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);

the IE debugger finded the error on this line.

strg = strg.replace(/left|top/g,'0px');

I want use this plug-in because the backgroundPositionY or X aren’t compatible on firefox and Opera. How to fix the error on IE7 and 8?.

  • 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-10T06:57:38+00:00Added an answer on June 10, 2026 at 6:57 am

    It’s possible find the solution in this link, IE8 and jQuery null pointers In any case this is the code that fix the ie bug

    /**
     * @author Alexander Farkas
     * v. 1.02
     */
    (function($){   
        $.extend($.fx.step,{       
            backgroundPosition: function(fx){            
                if (fx.state === 0 && typeof fx.end == 'string'){
                    if(navigator.appName == 'Microsoft Internet Explorer'){ //bugfix to IE
                        var start = $.curCSS(fx.elem,'backgroundPositionX');
                        start +=  ' ';
                        start += $.curCSS(fx.elem,'backgroundPositionY');
                    }
                    else {
                        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);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this tutorial to create a simple Hello World extension for Chrome: http://code.google.com/chrome/extensions/getstarted.html
My question is an extension of that one: Immutable numpy array? This code prints
I got a javascript code like this to validate the file extension for my
This code disabled mouse scroll functionality, when i click on the document. $(document).on(click, function
This code : http://jsfiddle.net/bYtTG/1/ Works as I want in FF, chrome and opera, but
I generated a View using VS 2010 functionality. This auto code generation created this
I created a style.css.php file with this code: <?php $gzip = (ob_get_length() === false
This is an extension question to: how-do-i-create-a-self-signed-certificate-for-code-signing-on-windows To take this further, if I have
This code below allows me to find the word error in all my files
This code is the core of a much larger script that works great in

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.