1;/* FilePath: /home/asam/projects/afkarnews_com/project/www-stable/app/webroot/js/jquery.innerfade.js */ 2/* ========================================================= 3 4// jquery.innerfade.js 5 6// Datum: 2008-02-14 7// Firma: Medienfreunde Hofmann & Baldes GbR 8// Author: Torsten Baldes 9// Mail: [email protected] 10// Web: http://medienfreunde.com 11 12// based on the work of Matt Oakes http://portfolio.gizone.co.uk/applications/slideshow/ 13// and Ralf S. Engelschall http://trainofthoughts.org/ 14 15 * 16 * <ul id="news"> 17 * <li>content 1</li> 18 * <li>content 2</li> 19 * <li>content 3</li> 20 * </ul> 21 * 22 * $('#news').innerfade({ 23 * animationtype: Type of animation 'fade' or 'slide' (Default: 'fade'), 24 * speed: Fading-/Sliding-Speed in milliseconds or keywords (slow, normal or fast) (Default: 'normal'), 25 * timeout: Time between the fades in milliseconds (Default: '2000'), 26 * type: Type of slideshow: 'sequence', 'random' or 'random_start' (Default: 'sequence'), 27 * containerheight: Height of the containing element in any css-height-value (Default: 'auto'), 28 * runningclass: CSS-Class which the container getâs applied (Default: 'innerfade'), 29 * children: optional children selector (Default: null) 30 * }); 31 * 32 33// ========================================================= */ 34 35 36(function($) { 37 38 $.fn.innerfade = function(options) { 39 return this.each(function() { 40 $.innerfade(this, options); 41 }); 42 }; 43 44 $.innerfade = function(container, options) { 45 var settings = { 46 'animationtype': 'fade', 47 'speed': 'normal', 48 'type': 'sequence', 49 'timeout': 2000, 50 'containerheight': 'auto', 51 'runningclass': 'innerfade', 52 'children': null 53 }; 54 if (options) 55 $.extend(settings, options); 56 if (settings.children === null) 57 var elements = $(container).children(); 58 else 59 var elements = $(container).children(settings.children); 60 if (elements.length > 1) { 61 $(container).css('position', 'relative').css('height', settings.containerheight).addClass(settings.runningclass); 62 for (var i = 0; i < elements.length; i++) { 63 $(elements[i]).css('z-index', String(elements.length-i)).css('position', 'absolute').hide(); 64 }; 65 if (settings.type == "sequence") { 66 setTimeout(function() { 67 $.innerfade.next(elements, settings, 1, 0); 68 }, settings.timeout); 69 $(elements[0]).show(); 70 } else if (settings.type == "random") { 71 var last = Math.floor ( Math.random () * ( elements.length ) ); 72 setTimeout(function() { 73 do { 74 current = Math.floor ( Math.random ( ) * ( elements.length ) ); 75 } while (last == current ); 76 $.innerfade.next(elements, settings, current, last); 77 }, settings.timeout); 78 $(elements[last]).show(); 79 } else if ( settings.type == 'random_start' ) { 80 settings.type = 'sequence'; 81 var current = Math.floor ( Math.random () * ( elements.length ) ); 82 setTimeout(function(){ 83 $.innerfade.next(elements, settings, (current + 1) % elements.length, current); 84 }, settings.timeout); 85 $(elements[current]).show(); 86 } else { 87 alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\''); 88 } 89 } 90 }; 91 92 $.innerfade.next = function(elements, settings, current, last) { 93 if (settings.animationtype == 'slide') { 94 $(elements[last]).slideUp(settings.speed); 95 $(elements[current]).slideDown(settings.speed); 96 } else if (settings.animationtype == 'fade') { 97 $(elements[last]).fadeOut(settings.speed); 98 $(elements[current]).fadeIn(settings.speed, function() { 99 removeFilter($(this)[0]); 100 });
101 } else 102 alert('Innerfade-animationtype must either be \'slide\' or \'fade\''); 103 if (settings.type == "sequence") { 104 if ((current + 1) < elements.length) { 105 current = current + 1; 106 last = current - 1; 107 } else { 108 current = 0; 109 last = elements.length - 1; 110 } 111 } else if (settings.type == "random") { 112 last = current; 113 while (current == last) 114 current = Math.floor(Math.random() * elements.length); 115 } else 116 alert('Innerfade-Type must either be \'sequence\', \'random\' or \'random_start\''); 117 setTimeout((function() { 118 $.innerfade.next(elements, settings, current, last); 119 }), settings.timeout); 120 }; 121 122})(jQuery); 123 124// **** remove Opacity-Filter in ie **** 125function removeFilter(element) { 126 if(element.style.removeAttribute){ 127 element.style.removeAttribute('filter'); 128 } 129}
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.