0

I want to hide/ show div both at the same time but the effect does not work immediately.

Here is my code :

$('a').on('click', function(){
    var div_hide = $(this).parent();
    var div_show = $(this).attr('href');
    $(div_hide).hide("slide", { direction: "left" }, 500);
    $(div_show).show("slide", { direction: "right" }, 800); //Doesn't work
    //$(div_show).delay(500).show("slide", { direction: "right" }, 800); //Work but i must waiting...
});

Here a fiddle http://jsfiddle.net/e3tAZ/

Do you have an alternative solution maybe ?

Jeff B
  • 29,943
  • 7
  • 61
  • 90
jlafforgue
  • 287
  • 2
  • 5
  • 15
  • possible duplicate of [How to build simple jQuery image slider with sliding or opacity effect?](http://stackoverflow.com/questions/12608356/how-to-build-simple-jquery-image-slider-with-sliding-or-opacity-effect) – Ram Dec 18 '13 at 22:28

1 Answers1

1

Set queue to false

$(div_hide).hide({ direction: "left", queue: false, duraton: 500 });
$(div_show).show({ direction: "right", queue: false, duraton: 500 });

Read the docs

fiddle

Kevin
  • 1,934
  • 1
  • 15
  • 10