Created
February 9, 2017 15:41
-
-
Save DriginCode/3e601ed45c1019286896eadaed8027ab to your computer and use it in GitHub Desktop.
scroll onclick on page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function() { | |
$("#js-get-started").on("click", function(e){ // при нажатии на ссылку с id js-get-started | |
e.preventDefault(); | |
var plansOffset = $("#js-plans").offset().top; // вычисляется высота от вверха браузера до нужного элемента с id js-plans | |
$("html, body").animate({ // реализация самой прокрутки на высчитанное ранее растояние plansOffset за 500 миллисекунд | |
scrollTop: plansOffset | |
}, 500); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment