Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(function() {
- $('.menu__item a').on('click', function(e) {
- e.preventDefault();
- $('.menu__item a').removeClass('active').filter(this).addClass('active');
- var selector = $(this).attr('href');
- var goTo = $(selector);
- $('html, body').animate({
- scrollTop: goTo.offset().top
- },500);
- });
- $(window).on('scroll', function(){
- var $arrow = $('.arrow');
- var scrolled = $(this).scrollTop();
- if (scrolled >= 500) {
- $arrow.fadeIn();
- } else if (scrolled < 500) {
- $arrow.fadeOut();
- }
- $arrow.on('click', function(e){
- e.preventDefault();
- $('html, body').animate({
- scrollTop: 0
- },500);
- });
- });
- $(function() {
- $('.menu__item a').on('click', function(e) {
- e.preventDefault();
- $('.menu__item a').removeClass('active').filter(this).addClass('active');
- var selector = $(this).attr('href');
- var goTo = $(selector);
- $('html, body').animate({
- scrollTop: goTo.offset().top
- },500);
- });
- var $arrow = $('.arrow');
- $arrow.on('click', function(e){
- e.preventDefault();
- $('html, body').animate({
- scrollTop: 0
- },500);
- });
- $(window).on('scroll', function(){
- var scrolled = $(this).scrollTop();
- if (scrolled >= 500) {
- $arrow.fadeIn();
- } else if (scrolled < 500) {
- $arrow.fadeOut();
- }
- });
- });
Add Comment
Please, Sign In to add comment