JQuery fadeIn () function: changing element transparency

- - . , , . javascript- jQuery fadeIn() - . .

Fade-

fadeIn() 100%. jQuery fadeOut(), "" .

fadeTo(), . FadeTo() 0 1.

JQuery fadeIn () function




fadeIn() jQuery , . :

element.fadeIn();
element.fadeIn(duration);
element.fadeIn(duration, callback);
element.fadeIn(duration, easing, callback);
element.fadeIn(config);
      
      



duration



, . , , :





  • 'fast'



    (200ms);
  • 'slow'



    (600ms);

duration



, 400 .

callback



, . callback- . this DOM-.

JQuery fadeOut () function




easing



, . . , , 'swing'



.

jQuery fadeIn() .block , :

$('.block').fadeIn(1000, linear, function() {
  console.log(' ');
});
      
      



, config



, 11 .

callback, jQuery fadeIn(), - , , .

const callback = function() {
  console.log(' ');
};
$('.element').fadeIn(1000);
callback();
      
      



, .

, callback



, :

const callback = function() {
  console.log(' ');
};
$('.element').fadeIn(1000, callback);
      
      



, .

, opacity



, . , - .

Therefore, the fade methods of the jQuery library: fadeIn (), fadeTo (), and fadeOut () work with transparency in combination with a property display



. A completely transparent element is hidden using a rule display: none



, and before it appears, this rule is canceled.




All Articles