Scrolling to an anchor link with jQuery -
this question has answer here:
- how scroll specific item using jquery? 12 answers
i have link @ top page linked #here. how can make page scroll down anchor link #here? i've been going google , jquery site, don't know do. js code i've got.
html:
<div class="container"> <div class="header"> <a class="link" href="#here">here</a> </div> <div class="footer"> <a id="here"></a> <p>some text...</p> </div> </div>
js:
$('.link').click(function() { $(this).scroll() });
you can add:
$('.link').click(function() { $("html, body").animate({ scrolltop: $('#here').offset().top }, 1000); });
Comments
Post a Comment