function load_content(page) {
    if(loaded_page == page || page == '') {
        return false;
    }
    var $container = $("#dynamic-content");
	$container.load(page+".html", function(response, status, xhr) {
		if(status != "error") {
            setup_page_events($container);
            if(state_is_new_page_load) $('body, html').animate({ scrollTop: 0 }, 500);
            state_is_new_page_load = false;
        }
        else {
			$container.html("<div><h1>Error</h1><p>An error occurred: " + xhr.status + " " + xhr.statusText + "</p></div>");
		}
	});
	$("#navbar .active").removeClass("active");
    $("#navbar > ul > li > a[data-page='" + page + "']").parent().addClass("active");
	set_current_hash(page);
    loaded_page = page;
    return true;
}
/**
    Note: uses and resets state_is_new_page_load variable to decide whether to scroll up
    (I know, this is messy)
*/
uses and resets state_is_new_page_load variable to decide whether to scroll up
(I know, this is messy)
uses and resets state_is_new_page_load variable to decide whether to scroll up ( I know this is messy )
function load_content(page) {
    if(loaded_page == page || page == '') {
        return false;
    }
    var $container = $("#dynamic-content");
	$container.load(page+".html", function(response, status, xhr) {
		if(status != "error") {
            setup_page_events($container);
            if(state_is_new_page_load) $('body, html').animate({ scrollTop: 0 }, 500);
            state_is_new_page_load = false;
        }
        else {
			$container.html("<div><h1>Error</h1><p>An error occurred: " + xhr.status + " " + xhr.statusText + "</p></div>");
		}
	});
	$("#navbar .active").removeClass("active");
    $("#navbar > ul > li > a[data-page='" + page + "']").parent().addClass("active");
	set_current_hash(page);
    loaded_page = page;
    return true;
}
function load_content ( page ) { if ( loaded_page == page || page == '' ) { return false ; } var $container = $ ( "#dynamic-content" ) ; $container . load ( page + ".html" , function ( response , status , xhr ) { if ( status != "error" ) { setup_page_events ( $container ) ; if ( state_is_new_page_load ) $ ( 'body, html' ) . animate ( { scrollTop : 0 } , 500 ) ; state_is_new_page_load = false ; } else { $container . html ( "<div><h1>Error</h1><p>An error occurred: " + xhr . status + " " + xhr . statusText + "</p></div>" ) ; } } ) ; $ ( "#navbar .active" ) . removeClass ( "active" ) ; $ ( "#navbar > ul > li > a[data-page='" + page + "']" ) . parent ( ) . addClass ( "active" ) ; set_current_hash ( page ) ; loaded_page = page ; return true ; }
Note: uses and resets state_is_new_page_load variable to decide whether to scroll up
(I know, this is messy)
Note : uses and resets state_is_new_page_load variable to decide whether to scroll up ( I know this is messy )