Skip to content

Instantly share code, notes, and snippets.

@BulatSa
Last active February 21, 2017 14:32
Show Gist options
  • Save BulatSa/87c293fda5fcda67cda8f170c8a542f3 to your computer and use it in GitHub Desktop.
Save BulatSa/87c293fda5fcda67cda8f170c8a542f3 to your computer and use it in GitHub Desktop.
Прокрутка к секциям с Velocity.js, необходимо его подключить
<a href="#" data-anchor="to-section">
<section id="to-section"></section>
/**************************************************
Прокрутка к секциям с Velocity.js
***************************************************/
$('body a[data-anchor]').click(function (event) {
event.preventDefault();
elementClick = "#" + $(this).data("anchor");
destination = $(elementClick).offset().top;
$('html').velocity( "scroll", { duration: 1000, easing: "easeInOutCubic", offset: destination, mobileHA: true });
$('body').velocity( "scroll", { duration: 1000, easing: "easeInOutCubic", offset: destination, mobileHA: true });
return false;
});
/**************************************************
End Прокрутка к секциям
***************************************************/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment