Created
October 21, 2009 22:52
-
-
Save bernsno/215553 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 showCategory(){ $(this).find("span").animate({top:"0px"}, 200); } | |
| function hideCateogry() { $(this).find("span").animate({top:"30px"}, 200); } | |
| function loadContent(content) { moveAboveTop(); $('#content').load(content,'',showNewContent()); } | |
| function showNewContent() { $('#content').show('normal'); } | |
| function setWindowLocationHash(url) { window.location.hash = url.substr(0,url.length-5); } | |
| function moveAboveTop() { | |
| if ( window.location.hash.length > 0 ){ | |
| $("#page-wrap").animate({top:"-180px"}, 200); | |
| } | |
| else { | |
| $("#page-wrap").animate({top:"0px"}, 200); | |
| } | |
| } | |
| $(document).ready(function(){ | |
| var hash = window.location.hash.substr(1); | |
| $('#site-nav a').each(function(){ | |
| var href = $(this).attr('href'); | |
| if( hash == href.substr(0,href.length-5) ){ | |
| var toLoad = hash+'.html #content'; | |
| $('#content').load(toLoad); | |
| moveAboveTop(); | |
| } | |
| }); | |
| $("#site-nav ul.image-nav li a").hover(showCategory, hideCateogry); | |
| $("#site-nav a").live("click", function(){ | |
| var newUrl = $(this).attr('href'); | |
| var newContent = newUrl + ' #content'; | |
| setWindowLocationHash(newUrl); | |
| $('#content').hide('fast',loadContent(newContent)); | |
| return false; | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment