我通過代碼,我只是不明白什麼是offset
函數返回:在jQuery中返回的偏移量函數是什麼?
$(document).ready(function() {
$('#goto-show-form').click(function() {
$('html, body').animate({scrollTop: $("#show-form").offset().top}, '500');
$('#first-field').focus();
return false;
});
});
請解釋offset
功能以及它是如何工作的,並返回結果是什麼。那麼,什麼是它返回在:
$("#show-form").offset().top
是什麼div
頂部和頂部offset
之間的區別?
你檢查了jQuery中的函數的文檔? http://api.jquery.com/offset/ – NoLifeKing 2011-12-23 08:52:31