IE8 and jQuery night pointers

Hey guys: I created a website with some animated rollovers, where I animated the background image to give the effect of color fading. It works fine in FF3, Safari, chrome, but IE8 throws the error "undefined is null or non-object."

Full text:

Message: 'undefined' is null or not an object
Line: 22
Char: 16
Code: 0
URI: http://www.philipdukes.co.uk/jquery.bgpos.js


Message: 'undefined' is null or not an object
Line: 22
Char: 16
Code: 0
URI: http://www.philipdukes.co.uk/jquery.bgpos.js

In my web page header I load jquery 1.3.2, then this bgpos library, found by the link in the error, then my script homepage .

Anytime when I flip the navigation buttons, IE8 throws this error ...

Any help would be appreciated: I know that my code may not be the most stylish, so criticism of the constructive would also be welcome. I would like to focus on this error though ...

shearn89

+3
3

, , ,

$(item).css({backgroundPosition: '0 -246px'});

else script.

: , Jitter , ", IE8 undefined , ". backgroundPosition else , .

+1

jquery.bgpos.js , IE.

(function($) 
{   
    $.extend($.fx.step,
    {       
        backgroundPosition: function(fx) 
        {            
            if (fx.state === 0 && typeof fx.end == 'string') 
            {
                if(navigator.appName == 'Microsoft Internet Explorer')
                {
                    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);
+11

, / , .

IE8 toArray(strg) (jquery.bgpos.js) undefined. IMHO , $.curCSS(fx.elem,'backgroundPosition') undefined fx.end undefined.

, curCss . , IE8 undefined background-position, .

alert , curCss / fx.end undefined. , .

0

Source: https://habr.com/ru/post/1723626/


All Articles