Last active
November 8, 2015 16:51
-
-
Save xto3na/d5623e695a94c5774cb4 to your computer and use it in GitHub Desktop.
Плавный скролл к якорю
This file contains hidden or 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
<script> | |
$(document).ready(function () { | |
/* Плавная прокрутка */ | |
$("#scroll-reviews").click(function () { | |
var elementClick = $(this).attr("href"); | |
var destination = $(elementClick).offset().top; | |
$("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, 1500); | |
return false; | |
}); | |
/* Плавная прокрутка END */ | |
}); | |
</script> | |
//Или так: | |
// Back to top | |
$('a.top').click(function (e) { | |
e.preventDefault(); | |
$(document.body).animate({scrollTop: 0}, 800); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment