Created
October 5, 2017 18:02
-
-
Save adavia/6bacdd3cc288cb1ba1cf3d27e65548ee to your computer and use it in GitHub Desktop.
Module pattern
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
| var Home = (function() { | |
| var links = $("[data-behavior~=anchor-link]"); | |
| var cover = $('.cover'); | |
| var init = function() { | |
| $(window).on("load", coverFadeOut); | |
| } | |
| var coverFadeOut = function() { | |
| cover.fadeOut(1000, function() { | |
| $(this).remove(); | |
| }); | |
| } | |
| var scrollDown = function() { | |
| links.click(animateScroll); | |
| } | |
| var animateScroll = function(event) { | |
| if ($(this.hash)) { | |
| $('html, body').animate({ | |
| scrollTop: $(this.hash).offset().top | |
| }, 500); | |
| } | |
| }; | |
| return { | |
| init: init, | |
| scroll: scrollDown | |
| }; | |
| })(); | |
| Home.init(); | |
| Home.scroll(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment