div getClientRects

 

 

 

;var aa = document.createElement('div');
aa.style.cssText = '\n        position: absolute;\n        left: -9999px;\n        font-size: 14px;\n        font-family: Arial, sans-serif;\n      ';
aa.textContent = 'BrowserScan ClientRects Test';
document.body.appendChild(aa);

var ab = aa.getClientRects();
var ac = Array.from(ab).map(function(zz) {
    debugger;
    return {
        'top': zz['top'],
        'right': zz['right'],
        'bottom': zz['bottom'],
        'left': zz['left'],
        'width': zz['width'],
        'height': zz['height']
    };
});
document['body']['removeChild'](aa);

console.log(JSON.stringify(ac));

 

posted @ 2024-07-26 15:19  AngDH  阅读(4)  评论(0编辑  收藏  举报