Make logo go to home, fix click handler

This commit is contained in:
Ray Schamp 2015-05-06 10:17:51 -04:00
parent a473ebf565
commit 34d59aab3e
2 changed files with 8 additions and 6 deletions

View file

@ -12,7 +12,7 @@
<main>
<header>
<div>
<h1 class="scratchx-logo"><span>ScratchX</span></h1>
<a href="#home" data-staticlink="home"><h1 class="scratchx-logo"><span>ScratchX</span></h1></a>
<nav class="main-nav">
Related Sites:
<ul>

View file

@ -104,6 +104,13 @@ swfobject.switchOffAutoHideShow();
swfobject.embedSWF('Scratch.swf', 'editor', '100%', '100%', '11.7.0', 'libs/expressInstall.swf',
flashVars, params, null, handleEmbedStatus);
/* Page switching */
$("[data-staticlink]").click(function(e) {
e.preventDefault();
showPage($(this).attr("data-staticlink"));
});
function showPage(path) {
var toHide = "body > main, body > main > article, #editor";
var toShow = "#" + path;
@ -113,11 +120,6 @@ function showPage(path) {
$(toShow).show();
}
$("[data-staticlink]").click(function(e) {
e.preventDefault();
showPage(e.target.attributes['data-staticlink'].value)
});
var initialID = "home";
function initPage() {
if (window.location.hash) initialID = window.location.hash.substr(1);