Team:TU Delft/test

From 2010.igem.org

(Difference between revisions)
Line 60: Line 60:
// $("#iGEM_TU_Delft_container").html('<iframe src="'+url+'" width="100%" height="100%"></iframe>');
// $("#iGEM_TU_Delft_container").html('<iframe src="'+url+'" width="100%" height="100%"></iframe>');
// });
// });
 +
}
}
Line 137: Line 138:
}
}
-
function loadPage(page)
+
 
 +
function moveToAnchor(anchor) {
 +
var pos = $('#load > a[name='+anchor+']').offset();
 +
dbgout('anchor: '+anchor+';  pos=' + pos.left + ','+pos.top );
 +
window.scroll(pos.left, pos.top);
 +
}
 +
 
 +
 
 +
function loadPage(page, anchor)
{
{
var showLoadAnim = !!currentPage;
var showLoadAnim = !!currentPage;
Line 156: Line 165:
$(window).trigger('page_init');
$(window).trigger('page_init');
rewriteLinks($("#iGEM_TU_Delft_container"));
rewriteLinks($("#iGEM_TU_Delft_container"));
 +
if (anchor) moveToAnchor(anchor);
updateContentEditLink();
updateContentEditLink();
$("#iGEM_TU_Delft_container").fadeTo(200,1);
$("#iGEM_TU_Delft_container").fadeTo(200,1);
Line 186: Line 196:
if (changepage) {
if (changepage) {
-
loadPage(changepage);
+
loadPage(changepage, kvmap.anchor);
-
} else
+
} else {
 +
if(kvmap.anchor) moveToAnchor(kvmap.anchor);
$(window).trigger('hashupdate');
$(window).trigger('hashupdate');
 +
}
}
}
} else {
} else {
Line 194: Line 206:
}
}
}
}
 +
Line 201: Line 214:
var url = this.href;
var url = this.href;
-
if(this.hash)
+
if(this.hash) {
-
this.href = this.hash;
+
//this.href = this.hash;
-
else if(txt != "edit")
+
this.href = '#page=' + currentPage + '&anchor=' + this.hash.substring(1);
 +
} else if(txt != "edit")
this.href = this.href.replace("https://2010.igem.org/Team:TU_Delft/", "#page=");
this.href = this.href.replace("https://2010.igem.org/Team:TU_Delft/", "#page=");
-
// dbgout('rewriting ' + url + ' to ' + this.href);
+
dbgout('rewriting ' + url + ' to ' + this.href);
});
});
}
}

Revision as of 13:41, 26 October 2010