Created
June 4, 2019 04:12
-
-
Save MikeRixWolfe/681f2ebbd29730a6ada3f777508c0bbf 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
$(window).on("load", function () { | |
hashRoute(location.hash.replace('#', '') || "index"); | |
}); | |
$(window).on('hashchange', function () { | |
hashRoute(location.hash.replace('#', '')); | |
}); | |
function hashRoute(route) { | |
$("html, body").animate({ scrollTop: 0 }, "fast"); | |
//$("section").load(route); | |
if (route.length > 0 && $("#hashrouter>#" + route).length > 0) { | |
$("#hashrouter").children().hide(); | |
$("#hashrouter>#" + route).show(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment