This time I will bring you JavaScriptcode to hide elements one by one, Use JavaScriptcodeWhat are the precautions for hiding elements one by one? The following is a practical case, let’s take a look.
The following jQuery plug-in can hide a group of elements one by one according to the step size (interval time) you set. Used in reloading list elements, you can achieve good results.
$.fn.fadeAll = function (ops) { var o = $.extend({ delay: 500, // delay between elements speed: 500, // animation speed ease: 'swing' // other require easing plugin }, ops); var $el = this; for (var i=0, d=0, l=$el.length; i<l; i++, d+=o.delay) { $el.eq(i).delay(d).fadeIn(o.speed, o.ease); } return $el; }
How to use:
$(elements).fadeAll({ delay: 300, speed: 300 });
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to the php Chinese website Other related articles!
Recommended reading:
JavaScript code to animate text
JavaScript code snippet to determine whether the date is valid
The above is the detailed content of JavaScript code to hide elements one by one. For more information, please follow other related articles on the PHP Chinese website!