How can I fade out + insert an element?

I want the slide + element to disappear when I try to make

$("ul", this).fadeIn(300).slideDown(600); 

I just get fadeIn, how can I fade out on an element slide?

+4
source share
3 answers

You can use animation for this.

 $("ul").animate({ "height": "toggle", "opacity": "toggle" }, "slow"); 
+9
source

it will slide down and then disappear in

paste this function somewhere

 jQuery.fn.doubleHide = function(){ return $(this).hide().css('opacity', '0'); } jQuery.fn.slideFade = function(slide, fade){ return $(this).slideDown(slide, function () { $(this).fadeTo(fade, 100); }); } 

then u can call this function like fadeIn ()

  $(this).stop(true).doubleHide().slideFade(400, 2000); 
+2
source

First, try calling hide (), either in the chain or in a different way, and change the functions around:

 $("ul").hide().slideDown(600).fadeIn(300); 
+1
source

Source: https://habr.com/ru/post/1341390/


All Articles