footLinks是通过jquery选定的DOM元素的数组。这是我正在处理的代码:
var footLinks = $('.links li');
for (var i = 0; i < footLinks.length; i++) {
var footLink = footLinks[i];
var footLinkWidth = footLink.width();
console.log('Width: ' + footLinkWidth);
}
如何获得每个元素的宽度?
我认为最好这样写:
$('.links li').each(function(d) {
console.log("Width: "+$(this).width())
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句