Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="fadeBox" style="width:200px; height:200px;">
- <img src="https://lh5.googleusercontent.com/-QXtBl36Dl-s/AAAAAAAAAAI/AAAAAAAAAE8/R-8wXJllxyw/s100-c/photo.jpg">
- <img src="https://lh5.googleusercontent.com/-uQqDiQ92aZQ/TiZspaC99wI/AAAAAAAAAFE/KZU_RIKUfTI/s150-c/photo.jpg">
- <img src="https://lh5.googleusercontent.com/-vp16kljkPwg/AAAAAAAAAAI/AAAAAAAAAKg/Ypz8rdBRFjQ/s200-c/photo.jpg">
- </div>
- function fadeInit(color){
- color = !color ? "#FFF" : color;
- $("#fadeBox img").each(function(){
- $(this).replaceWith( "<div>" + this.src + "</div>" );
- });
- $("#fadeBox div").each(function(){
- $(this).css("width",$(this).parent().width());
- $(this).css("height",$(this).parent().height());
- $(this).css("background-image","url(" + $(this).text() + ")");
- $(this).text("");
- $(this).wrap("<td style='background-color:"+color+"'>");
- });
- $("#fadeBox td").wrapAll("<table style='position:relative; width:100%; height:100%;'><tbody><tr></tr></tbody></table>");
- $("#fadeBox div").show();
- }
- function fadeShow(fadeTime, fadeDelay){
- var $topImage = $("#fadeBox td:last");
- $topImage.fadeTo(fadeDelay,1,function(){
- $topImage.fadeTo(fadeTime,0,function(){
- $topImage.fadeTo(fadeDelay,1);
- $topImage.insertBefore("#fadeBox td:first");
- fadeShow(fadeTime, fadeDelay);
- });
- });
- }
- fadeInit("#000");
- fadeShow(500,1000);
- #fadeBox td
- {
- position:absolute;
- width:100%;
- height:100%;
- user-select: none;
- -moz-user-select: -moz-none;
- -khtml-user-select: none;
- -webkit-user-select: none;
- }
- #fadeBox img
- {
- display:none;
- }
- #fadeBox div
- {
- background-repeat:repeat-x;
- }
- http://jsfiddle.net/PvPXM/1/
Advertisement
Add Comment
Please, Sign In to add comment