is this the correct use of JavaScript or is there a better way ? jquery slide to anchor
- by Stuart Robson
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