Answer the question
In order to leave comments, you need to log in
Anchor link without url replacement, how to do this?
Hello everyone, we all know how to make simple anchor links in html
<div id="top"></div>
<a href="#top">на верх</a>
/#top
Answer the question
In order to leave comments, you need to log in
Element.onclick = function(e){
e.preventDefault();
document.querySelector(this.hash).scrollIntoView();
}
$('a[href^="#"]').on('click',function (e) {
e.preventDefault();
var target = $(this.hash);
$('html, body').stop().animate({
'scrollTop': target.offset().top
}, 500);
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question