Kamczatka Kamczatka - 1 year ago 66
CSS Question

FadeOut finish and then do something

I have some issues with my slider. I have colored div (in original project is image) and text on it. All i want is:

  1. fadeIn background-color

  2. fadeIn text

  3. fadeOut Text

  4. fadeOut background-color.

Itssounds simply but I cant get this effect. I cant do fadeOut text in time, its suddenly disappear. I tried add anonymous funcion in fadeOut() and it didnt works.

<section class="opinions">
<div class="opinionsContent">
<div class="slider">

Here's code :

Answer Source

This should work with fadeOut callback :


    $('.opinions .slider').removeClass(sliderBGClasses[currentClass]);
    $('.opinions .slider h2').fadeOut('slow', function() {
        currentClass = currentClass + 1 < descriptionsClasses.length ? currentClass + 1 : 0;
        $('.opinions .slider h2').fadeIn('slow').addClass(descriptionsClasses[currentClass]);
        $('.opinions .slider').addClass(sliderBGClasses[currentClass]);


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download