Created
November 9, 2016 12:02
-
-
Save luisfelipe-dev/54df8a50f5f192adc9f9e5eeefa8541b 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
| $('a[href*=#]').each(function () { | |
| if (filterPath(location.pathname) == filterPath(this.pathname) | |
| && location.hostname == this.hostname | |
| && this.hash.replace(/#/, '')) { | |
| var $targetId = $(this.hash), $targetAnchor = $('[name=' + this.hash.slice(1) + ']'); | |
| var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false; | |
| if ($target) { | |
| var targetOffset = $target.offset().top; | |
| $(this).click(function () { | |
| if($(window).width() > 200){ | |
| $('html, body').animate({scrollTop: targetOffset}, 300); | |
| return false; | |
| } | |
| }); | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment