0

I want to play some animations when loading element's innerHTML, here is my code:

function loadslide(){

        ...
        $('.m').html($('.bigSlider div:nth-child(1)').html()).fadeIn("slow");
}

$('.rightarrow').click(function(event){

        event.preventDefault();

        loadslide();
});

but no animation is shown when I click the button.

Mohammad
  • 3,449
  • 6
  • 48
  • 75

1 Answers1

2

Welp, the element needs to be hidden for it to be able to fadeIn

So you'll have to arrange your element accordingly, if there's nothing showing for your element simply

 $('.m').hide().html($('.bigSlider div:nth-child(1)').html()).fadeIn("slow");

If that can't be done because it has some visible parts maybe you can have an inner div with nothing on it, so you can hide it. But it needs to be hidden beforehand

JSelser
  • 3,510
  • 1
  • 19
  • 40