views:

76

answers:

0

Hi Im wondering if any one can help me figure out how to use different sets navigation tabs to load content to different div's independently?

For example: a horizontal navigation bar that loads content in a header DIV, and e vertical navigation bar that loads content in a div in the body part of the page ?!

Here is the ajax script im using:

$(document).ready(function() {

var contentWrapID = '___content-wrapper';

$('#content').wrap('<div id="' + contentWrapID + '"></div>');

function showNewContent() {
    $("#" + contentWrapID).slideDown();
    $('#load').fadeOut();   
}

function pageload(hash) {
    if(hash) {
        $("#" + contentWrapID).load(hash + " #content",'',function(){
            if($('img:last',this).get(0)) {
                $('img:last',this).load(function(){
                    showNewContent();
                });
            } else {
                showNewContent();
            }

        });
    } else {
        $("#" + contentWrapID).load("index.html #content");
    }
}
$.historyInit(pageload);

$('#topnav li a').click(function(){

    var hash = $(this).attr('href');
    hash = hash.replace(/^.*#/, '');
    $("#" + contentWrapID).slideUp(300,function(){
        $.historyLoad(hash);
    });
    if(!$('#load').get(0)) {
        $('#container').append('<span id="load">LOADING...</span>');
    }
    $('#load').fadeIn('normal');
    $('#topnav li a').removeClass('current'); 
    $(this).addClass('current'); 
    return false;

});

});