Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Dec 2010
    Location
    California
    Posts
    201
    Thanks
    30
    Thanked 8 Times in 8 Posts

    IE8 fires off error messgage

    hello there, I have some code that is firing off an error message in IE8 that states " 'undefined' is null or not an object' on line 22 char 16. Anyone know why

    Code:
    /**
     * @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);
    Thanks in advance!

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    Shouldn't it be
    Code:
                   strg = strg.replace(/[left|top]/g,'0px');
                   strg = strg.replace(/[right|bottom]/g,'100%');
    Is 'fx.elem' correctly defined?
    "I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
    Validate your HTML and CSS


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •