0

I'm trying to fadeOut a variable, containing the classes I supplied:

var fadeOutDivs = "'.slider-bg , .inner-content , .about-app , .contact-us'"
$('.menu-li.a').click(function() {
    $(fadeOutDivs).fadeOut( 300 ).promise().done(function() {;
        $('.slider-bg.a , .about-app.a , .hand-with-mobile').fadeIn( 300 );
    });
});

Not working for me...

2
  • 3
    you don't need the inner quotes in fadeOutDivs Aug 20, 2014 at 16:21
  • oh well, for some reason thought i already gave it a try, but i guess i didn't... thanks a lot! :)
    – yuvalsab
    Aug 20, 2014 at 16:31

1 Answer 1

1

You seemed to be 'stringing' a string ;) You don't need the inner quotes when declaring your classes in the fadeOutDivs variable declaration.

You also have a random semi-colon after fadeOut callback function opening curly brace? but I am unsure if that is a typo when pasting into Stack Overflow.

Either way try this...

var fadeOutDivs = ".slider-bg , .inner-content , .about-app , .contact-us";
$('.menu-li.a').click(function() {
    $(fadeOutDivs).fadeOut( 300 ).promise().done(function() {
        $('.slider-bg.a , .about-app.a , .hand-with-mobile').fadeIn( 300 );
    });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.