Last active
August 29, 2015 14:05
-
-
Save guest271314/518fd80b0cd9e4834916 to your computer and use it in GitHub Desktop.
cycle.js
This file contains 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
/*! cycle.js Copyright (c) 2014 guest271314 http://opensource.org/licenses/BSD-2-Clause | |
`html` | |
<div id="cycle"> | |
<img src="" alt="" /> | |
<img src="" alt="" /> | |
<img src="" alt="" /> | |
<img src="" alt="" /> | |
</div> | |
`css` | |
#cycle img { | |
position:absolute; | |
opacity:0.0; | |
} | |
see http://jsfiddle.net/guest271314/4dog6za4/embedded/result/ | |
*/ | |
$(function () { | |
$.fx.interval = -1000; | |
(function cycle(n, cycler) { | |
cycler.eq(n) | |
.fadeTo(4000, 0.8, function () { | |
n = n < cycler.length - 1 ? ++n : 0; | |
cycle(n, cycler) | |
}).fadeTo(3000, 0.005); | |
}(0, $("#cycle img"))); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment