Created
July 16, 2013 11:31
-
-
Save ktroye/6007943 to your computer and use it in GitHub Desktop.
Javascript: Fading elements
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $.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; | |
| } | |
| $(elements).fadeAll({ delay: 300, speed: 300 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment