2012-10-18 55 views

回答

9

你必須遍歷了div:

$('div').each(function() { 
    console.log($(this).offset()); 
}); 
3

大廈@ dystroy的回答是:

var offsetCollection = new Array(); 
$('div').each(function() { 
    offsetCollection.push(
     $(this).offset(), $(this).index() 
    ); 
}); 

然後,您可以:

offsetCollection[0][0]; //div 1, offset 
offsetCollection[0][1]; //div 1, elementIndex 
相關問題