From 359dc8736a98118f50ae449bd05f164458bad5ce Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Sat, 21 Jul 2012 21:59:04 +0200 Subject: [PATCH] Improved scrollTo method. Still not quite there... --- apps/contacts/js/contacts.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/contacts/js/contacts.js b/apps/contacts/js/contacts.js index a0ad77d074..514821a44f 100644 --- a/apps/contacts/js/contacts.js +++ b/apps/contacts/js/contacts.js @@ -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'); } } }