Team:TU Delft/header2

From 2010.igem.org

(Difference between revisions)
Line 37: Line 37:
$(function() {
$(function() {
// Initialize history plugin.
// Initialize history plugin.
-
$.history.init(pageload);
+
$.history.init(historyCallback);
rewriteLinks($("#navlist"));
rewriteLinks($("#navlist"));
Line 82: Line 82:
}
}
-
function pageload(hash) {
+
function historyCallback(hash) {
alert('historyCallback: ' + hash);
alert('historyCallback: ' + hash);
// hash doesn't contain the first # character.
// hash doesn't contain the first # character.
if(hash) {
if(hash) {
-
// if(hash.split('=').length == 1) {
+
if(hash.split('=').length == 1) {
-
//alert('load hash as page: ' + hash);
+
alert('load hash as page: ' + hash);
loadPage(hash);
loadPage(hash);
-
// } else {
+
} else {
-
//     var kvmap = splitHash(hash);
+
    var kvmap = splitHash(hash);
-
// if (kvmap.page) {
+
if (kvmap.page) {
-
//alert('load hashmap.page: ' + kvmap.page);
+
alert('load hashmap.page: ' + kvmap.page);
-
// loadPage(kvmap.page);
+
loadPage(kvmap.page);
-
// } else if(kvmap.anchor)  {
+
} else if(kvmap.anchor)  {
-
//alert('scrolling to anchor: ' + kvmap.anchor);
+
alert('scrolling to anchor: ' + kvmap.anchor);
-
// window.scrollTo(0, $(kvmap.anchor).position().top);
+
window.scrollTo(0, $(kvmap.anchor).position().top);
-
// }
+
}
-
// }
+
}
} else {
} else {
// start default page
// start default page

Revision as of 13:26, 22 July 2010