1/* ========================================================= 2 3// jquery.innerfade.js 4 5// Datum: 2007-01-29 6// Firma: Medienfreunde Hofmann & Baldes GbR 7// Autor: Torsten Baldes 8// Mail: [email protected] 9// Web: http://medienfreunde.com 10 11// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/ 12 13// ========================================================= */ 14 15 16(function($) { 17 18$.fn.innerfade = function(options) { 19 20 this.each(function(){ 21 22 var settings = { 23 animationtype: 'fade', 24 speed: 'normal', 25 timeout: 2000, 26 type: 'sequence', 27 containerheight: 'auto', 28 runningclass: 'innerfade' 29 }; 30 31 if(options) 32 $.extend(settings, options); 33 34 var elements = $(this).children(); 35 36 if (elements.length > 1) { 37 38 $(this).css('position', 'relative'); 39 40 $(this).css('height', settings.containerheight); 41 $(this).addClass(settings.runningclass); 42 43 for ( var i = 0; i < elements.length; i++ ) { 44 $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute'); 45 $(elements[i]).hide(); 46 }; 47 48 if ( settings.type == 'sequence' ) { 49 setTimeout(function(){ 50 $.innerfade.next(elements, settings, 1, 0); 51 }, settings.timeout); 52 $(elements[0]).show(); 53 } else if ( settings.type == 'random' ) { 54 setTimeout(function(){ 55 do { current = Math.floor ( Math.random ( ) * ( elements.length ) ); } while ( current == 0 ) 56 $.innerfade.next(elements, settings, current, 0); 57 }, settings.timeout); 58 $(elements[0]).show(); 59 } else { 60 alert('type must either be \'sequence\' or \'random\''); 61 } 62 63 } 64 65 }); 66}; 67 68 69$.innerfade = function() {} 70$.innerfade.next = function (elements, settings, current, last) { 71 72 if ( settings.animationtype == 'slide' ) { 73 $(elements[last]).slideUp(settings.speed, $(elements[current]).slideDown(settings.speed)); 74 } else if ( settings.animationtype == 'fade' ) { 75 $(elements[last]).fadeOut(settings.speed); 76 $(elements[current]).fadeIn(settings.speed); 77 } else { 78 alert('animationtype must either be \'slide\' or \'fade\''); 79 }; 80 81 if ( settings.type == 'sequence' ) { 82 if ( ( current + 1 ) < elements.length ) { 83 current = current + 1; 84 last = current - 1; 85 } else { 86 current = 0; 87 last = elements.length - 1; 88 }; 89 } else if ( settings.type == 'random' ) { 90 last = current; 91 while ( current == last ) { 92 current = Math.floor ( Math.random ( ) * ( elements.length ) ); 93 }; 94 } else { 95 alert('type must either be \'sequence\' or \'random\''); 96 }; 97 setTimeout((function(){$.innerfade.next(elements, settings, current, last);}), settings.timeout); 98}; 99})(jQuery);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.