is this the correct use of JavaScript or is there a better way ? jquery slide to anchor

Posted by Stuart Robson on Stack Overflow See other posts from Stack Overflow or by Stuart Robson
Published on 2010-03-13T19:52:34Z Indexed on 2010/03/13 19:55 UTC
Read the original article Hit count: 298

Filed under:
|
|
|

Hi guys,

I'm currently workin on a project with a one page design that'll slide up and down between sections on an link...

currently i have it as

  • home
  • artist's materials
  • picture framing
  • gallery
  • contact us

or

<a href="javascript:void(0)" onClick="goToByScroll('contactus')">

hope fully you can see the code... then in a js file i've got

function goToByScroll(id){
    $('html,body').animate({scrollTop: $("#"+id).offset().top},'slow');

}

is this ok ??

or should this be done a different way ???

thanks in advance

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about slider