I wrote a snippet of code that works for the most part. I'm really trying to
shave it down and expand its functionality though and am having a hard as
hell time doing it. This chunk of code should [b]Theoretically[/b] allow a
bread
crumb trail using href as the crumb.
[code]
function PathWatch(path_change_cb, interval) {
// Store initial path
this.path = document.location.href;
// Store the function to call when the path changes
this.path_change_cb = path_change_cb;
// Default interval is 400 miliseconds
if (!interval) interval = 400;

this.check_new_path = function() {
// If the location has changed, store the new location
// and call the callback function
if (document.location.href != this.path) {
this.path = document.location.href;
this.path_change_cb();
}
}

// Check for a new path every interval miliseconds
this.oInterval = setInterval(this.check_new_path, interval);
}
[/code]

I would use something to this effect to call it, the real problem
is I don't want 3000+ lines of if/elseif statements declaring what
to do.

[code]
#web-administrator OMNISISTEM 
#contact Contact 

function path_changed() {
    if (document.location.hash == "#web-administrator") {
        loadDiv('<?=$lit;?>prl-pt.php','iContent');
    }
    else if (document.location.hash == "#contact") {
        loadDiv('layers/dealer/contact.php', 'iContent');
    }
    // Add more cases here..
}

PathWatch(path_changed);
[/code]

So what do I do? How do I turn it into JQuery? What are the
chances of specifying my loadDiv variables without an onclick
event, but save myself the hassle of making never ending if
elseifs?

All replies GREATLY appreciated, speculation or code tidying as well.
-- 
View this message in context: 
http://www.nabble.com/-Breadcrumb--Doing-it-in-JQuery--Source-Provided%21-tp22935369s27240p22935369.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to