Home > Web Front-end > JS Tutorial > body text

JavaScript code to hide elements one by one

php中世界最好的语言
Release: 2018-03-16 16:20:38
Original
1496 people have browsed it

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;
}
Copy after login

How to use:

$(elements).fadeAll({ delay: 300, speed: 300 });
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!