Loading

Jquery simple friendly scroll

this function is based on jquery 1.6.1 of mine,but i think its fit for most of the jqeury versions

function goToIdByScroll(id){
      $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');
  }//scrol by the element ID
function goToAnchorByScroll(id) {
      $('html,body').animate({ scrollTop: $('a[href$="' + id+'"]').offset().top }, 'slow');
  }//scrol by the anchor that in the href

posted @ 2011-06-28 15:36  today4king  阅读(193)  评论(1编辑  收藏  举报