javascript - Scroll Down to content without changing page URL -
<a href="#scrolldown" id="up">scroll down</a> <p>long paragraph.</p> <a name="scrolldown" id="down">stop here</a>
while click id 'up' should scroll down , stop in id 'down'.
right when click id 'up' url getting changed. example(../loginaction#scrolldown).
how scroll down id 'down' without changing page url. href 'scrolldown' won't apply page url.
you can getting offset of element , scrolling it.
var elementposition = document.getelementbyid('#myelement').offsettop; window.scrollto(0, elementposition);
Comments
Post a Comment