if statements not firing for jquery address #156

Open
tskweres opened this Issue Dec 11, 2012 · 0 comments

Comments

Projects
None yet
1 participant

I have jquery 1.7.2 and jquery-address 1.5 installed.

I want certain pages to load the ajax content in a different div. Essentailly my content pages work one way, but I also have a user dashboard with tabs, I want that to work differently. Even though I have an if statement for the dashboard elements, it only executes the else statement, and ignores the if. Any ideas?

So here's my code:

$(document).ready(function(){

var tabelements = {
     mainTabs: ['/main', '/search', '/messages', '/profile', '/payments'],
    //subTabs: ['elements/user-forms.html', 'elements/error-message.html'],
};
// Event handlers
$.address.init(function(event) {
    console.log("init: " + $('[rel="address:' + event.value + '"]').attr('href'));
}).change(function(event) {

    if (event.value == tabelements.mainTabs) {
        $('.body-wrap .page-body .dash-master').fadeOut(100, function() {
            $(".body-wrap .page-body .dash-master").load($('[rel="address:' + event.value + '"]').attr('href')).delay(150).fadeIn();
        });
    }
    else {
        $('.body-wrap .page-body').fadeOut(100, function() {
            $(".body-wrap .page-body").load($('[rel="address:' + event.value + '"]').attr('href')).delay(150).fadeIn();
        });
    }
});

});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment