Created
February 2, 2016 11:00
-
-
Save KeithNdhlovu/aa3c613de2d8b6d6acdb 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
| $(function() { | |
| $('a.page-scroll').bind('click', function(event) { | |
| var $anchor = $(this); | |
| //This implementation requires JQueryEasing plugin to work [http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js] | |
| $('html, body').stop().animate({ | |
| scrollTop: $($anchor.attr('href')).offset().top - 90 | |
| }, 1500, 'easeInOutExpo'); | |
| $(this).parents('.nav-container').find('.active').removeClass('active').end().end().addClass('active'); | |
| event.preventDefault(); | |
| }); | |
| $(window).scroll(function(){ | |
| var whatWeDo = $("#what-we-do"), | |
| whoWeWeAre = $("#who-we-are"), | |
| ourWork = $("#our-work"), | |
| connect = $("#connect"); | |
| if($(window).scrollTop() >= ( whatWeDo.offset().top - 90) ){ | |
| $('.nav-container').find('a[href="#what-we-do"]').parents('.nav-container').find('.active').removeClass('active').end().end().addClass('active'); | |
| } | |
| if($(window).scrollTop() >= ( whoWeWeAre.offset().top - 90) ){ | |
| $('.nav-container').find('a[href="#who-we-are"]').parents('.nav-container').find('.active').removeClass('active').end().end().addClass('active'); | |
| } | |
| if($(window).scrollTop() >= ( ourWork.offset().top - 90) ){ | |
| $('.nav-container').find('a[href="#our-work"]').parents('.nav-container').find('.active').removeClass('active').end().end().addClass('active'); | |
| } | |
| if($(window).scrollTop() >= ( connect.offset().top - 90) ){ | |
| $('.nav-container').find('a[href="#connect"]').parents('.nav-container').find('.active').removeClass('active').end().end().addClass('active'); | |
| } | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment