Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function(){
- $(".main-mnu a").click(function() {
- //отменяем стандартную обработку нажатия по ссылке
- event.preventDefault();
- //забираем идентификатор бока с атрибута href
- var id = $(this).attr('href'),
- //узнаем высоту от начала страницы до блока на который ссылается якорь
- top = $(id).offset().top;
- //прячем меню
- $('#desktop-menu ul').css('display', 'none');
- $('#desktop-menu').css('width', '0px');
- //анимируем переход на расстояние - top за 1500 мс
- $('body,html').animate({scrollTop: top}, 1500);
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement