GETBOUNDINGCLIENTRECT CAUSES 'UNSPECIFIED ERROR' IN IE7 AFTER AJAX in Jquery 1.4.2

/*By Jiangong SUN*/


This problem occurs when we calculate the offset for hidden div in ajax in our project. It's produced in IE 7.


Here is the solution : 


In jquery.1.4.2.js,

replace :


var box = elem.getBoundingClientRect(),

with :

var box = null;
try { 
   box = elem.getBoundingClientRect();
} catch(e) {
   box = { top : elem.offsetTop, left : elem.offsetLeft }
};


In jquery.1.4.2.min.js,
replace :

var d=b.getBoundingClientRect(),

with :

try{var d=b.getBoundingClientRect();}catch(ex){var d={top:0,left:0,right:0,bottom:0};}

Enjoy coding !



你可能感兴趣的:(GETBOUNDINGCLIENTRECT CAUSES 'UNSPECIFIED ERROR' IN IE7 AFTER AJAX in Jquery 1.4.2)