Плавный переход к якорю Jquery
Плавный переход к якорю Jquery
by Max Belov
HTML
<a href="#about" class="topLink">Подробнее о враче</a>
<div class="otstup" id="about">
текст куда нас должно опустить
</div>
CSS
.otstup {
margin-top: 1200px;
}
JavaScript
$(document).ready(function() {
$("a.topLink").click(function() {
$("html, body").animate({
scrollTop: $($(this).attr("href")).offset().top + "px"
}, {
duration: 1000,
easing: "swing"
});
return false;
});
});