您的位置:首页 > Web前端 > JQuery

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

2011-12-15 05:02 477 查看
/*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 !
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐