Team:TU Delft/header2

From 2010.igem.org

(Difference between revisions)
Line 28: Line 28:
<!-- Scripting - START /-->
<!-- Scripting - START /-->
-
<!-- <script type="text/javascript" src="http://nix.lv/history/jquery.history.js"></script> -->
+
<script type="text/javascript" src="http://github.com/cowboy/jquery-hashchange/raw/v1.3/jquery.ba-hashchange.js"></script>
-
<script type="text/javascript" src="https://2010.igem.org/Team:TU_Delft/files/jquery_history?action=raw&gen=fs"></script>
+
<script type="text/javascript">
<script type="text/javascript">
Line 38: Line 37:
$(function() {
$(function() {
// Initialize history plugin.
// Initialize history plugin.
-
$.history.init(historyCallback);
+
$.hashchange(historyCallback);
rewriteLinks($("#navlist"));
rewriteLinks($("#navlist"));
-
+
/*
// set onlick event for menu buttons
// set onlick event for menu buttons
$("#wrapper a").click(function(){
$("#wrapper a").click(function(){
Line 48: Line 47:
return false;
return false;
});
});
-
 
+
*/
// setup hovering
// setup hovering
$(".menu_button").hover(
$(".menu_button").hover(
Line 82: Line 81:
}
}
-
function historyCallback(hash) {
+
function historyCallback() {
 +
var hash = location.hash;
console.log('historyCallback: ' + hash);
console.log('historyCallback: ' + hash);
-
// hash doesn't contain the first # character.
 
if(hash) {
if(hash) {
 +
hash = hash.substring(1);
if(hash.split('=').length == 1) {
if(hash.split('=').length == 1) {
console.log('load hash as page: ' + hash);
console.log('load hash as page: ' + hash);
Line 94: Line 94:
console.log('load hashmap.page: ' + kvmap.page);
console.log('load hashmap.page: ' + kvmap.page);
loadPage(kvmap.page);
loadPage(kvmap.page);
-
} else if(kvmap.anchor)  {
 
-
console.log('scrolling to anchor: ' + kvmap.anchor);
 
-
//window.scrollTo(0, $(kvmap.anchor).position().top);
 
}
}
}
}

Revision as of 17:58, 22 July 2010