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

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -