Skip to content

Instantly share code, notes, and snippets.

@Solomko2
Created May 27, 2015 18:59
Show Gist options
  • Save Solomko2/4320a8c73df9ab60063c to your computer and use it in GitHub Desktop.
Save Solomko2/4320a8c73df9ab60063c to your computer and use it in GitHub Desktop.
Scroll To.js
(function () {
jQuery('#top_menu li a').on('click', function(){
var item = $(this).parent().attr('class'),
tar = $(this).attr('data');
$("html, body").animate({ scrollTop: jQuery(tar).offset().top }, 1000);
});
})()
// <li class="item-0"><a href="#begin" data=".header1" class="root-item">В начало</a></li>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment