Improved scrollTo method. Still not quite there...

This commit is contained in:
Thomas Tanghus 2012-07-21 21:59:04 +02:00
parent eb57544518
commit 359dc8736a
1 changed files with 3 additions and 3 deletions

View File

@ -1687,10 +1687,10 @@ Contacts={
},
scrollTo:function(id){
var item = $('#contacts li[data-id="'+id+'"]');
console.log('scrollTo, found item '+id+'? ' + item.length);
if(item) {
if(item && $.isNumeric(item.offset().top)) {
console.log('scrollTo ' + parseInt(item.offset().top));
$('#contacts').animate({
scrollTop: item.offset().top-40}, 'slow','swing');
scrollTop: parseInt(item.offset()).top-40}, 'slow','swing');
}
}
}