MediaWiki:Skin/Kamel:Ungott.js: Unterschied zwischen den Versionen

aus Kamelopedia, der wüsten Enzyklopädie
Zur Navigation springen Zur Suche springen
 
Zeile 15: Zeile 15:
  
 
$(function() {
 
$(function() {
 +
    $('#content').css({'position' : 'relative', 'overflow' : 'hidden'});
 
     for ( var i = 0; i < anz_bilder; i++ ){
 
     for ( var i = 0; i < anz_bilder; i++ ){
         $('div.lila').append(anim_bilder[i]);
+
         $('#content').append(anim_bilder[i]);
         $('div.lila img').last().css('position', 'absolute');
+
         $('#content img').last().css('position': 'absolute');
         var bottom = Math.round( ( ( $('div.lila').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
+
         var bottom = Math.round( ( ( $('#content').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
         var left  = Math.round( ( ( $('div.lila').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
+
         var left  = Math.round( ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
         $('div.lila img').last().css('bottom', bottom + 'px');
+
         $('#content img').last().css('bottom', bottom + 'px');
         $('div.lila img').last().css('left', left + 'px');
+
         $('#content img').last().css('left', left + 'px');
         $('div.lila img').last().animate(
+
         $('#content img').last().animate(
             { bottom: '+' + $('div.lila').outerHeight() }, {
+
             { bottom: '+' + $('#content').outerHeight() }, {
 
             duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
 
             duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
 
             easing: 'linear',
 
             easing: 'linear',
Zeile 29: Zeile 30:
 
             queue: false }
 
             queue: false }
 
         );
 
         );
         swing($('div.lila img').last(),  
+
         swing($('#content img').last(),  
             $('div.lila img').last().width() / 8 + ($('div.lila img').last().width() / 8 * Math.random()),
+
             $('#content img').last().width() / 8 + ($('#content img').last().width() / 8 * Math.random()),
 
             400 * Math.random() + 250);
 
             400 * Math.random() + 250);
 
     }
 
     }
Zeile 36: Zeile 37:
  
 
function resetimage(anim_bild) {
 
function resetimage(anim_bild) {
     var left  = ( ( $('div.lila').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
+
     var left  = ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
 
     anim_bild.css('left', left + 'px');   
 
     anim_bild.css('left', left + 'px');   
 
     anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
 
     anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
 
     anim_bild.animate(
 
     anim_bild.animate(
         { bottom: '+' + $('div.lila').outerHeight() }, {
+
         { bottom: '+' + $('#content').outerHeight() }, {
 
         duration: Math.round(7000 * Math.random() + 7000),
 
         duration: Math.round(7000 * Math.random() + 7000),
 
         easing: 'linear',
 
         easing: 'linear',

Version vom 25. August 2011, 22:21 Uhr

var anz_bilder  = 20;
var anim_bilder = new Array();
var bild_info = [
    { "src": "http://kamelopedia.mormo.org/images/6/6c/BunchieViola.gif",    "width": 53,  "height": 66 }
]

for ( var i = 0; i < anz_bilder; i++ ){
    var size              = Math.random() * 2;
    var src               = Math.floor(Math.random() * bild_info.length);
    anim_bilder[i]        = new Image;
    anim_bilder[i].src    = bild_info[src].src;
    anim_bilder[i].width  = bild_info[src].width * size;
    anim_bilder[i].height = bild_info[src].height * size;    
}

$(function() {
    $('#content').css({'position' : 'relative', 'overflow' : 'hidden'});
    for ( var i = 0; i < anz_bilder; i++ ){
        $('#content').append(anim_bilder[i]);
        $('#content img').last().css('position': 'absolute');
        var bottom = Math.round( ( ( $('#content').outerHeight() + anim_bilder[i].height ) * Math.random() ) - anim_bilder[i].height );
        var left   = Math.round( ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width );
        $('#content img').last().css('bottom', bottom + 'px');
        $('#content img').last().css('left', left + 'px');
        $('#content img').last().animate(
            { bottom: '+' + $('#content').outerHeight() }, {
            duration: Math.round(7000 * Math.random() + 7000) - bottom * 15,
            easing: 'linear',
            complete: function(){ resetimage($(this)); },
            queue: false }
        );
        swing($('#content img').last(), 
            $('#content img').last().width() / 8 + ($('#content img').last().width() / 8 * Math.random()),
            400 * Math.random() + 250);
    }
});

function resetimage(anim_bild) {
    var left   = ( ( $('#content').outerWidth() + anim_bilder[i].width ) * Math.random() ) - anim_bilder[i].width;
    anim_bild.css('left', left + 'px');   
    anim_bild.css('bottom', '-' + anim_bild.height() + 'px');
    anim_bild.animate(
        { bottom: '+' + $('#content').outerHeight() }, {
        duration: Math.round(7000 * Math.random() + 7000),
        easing: 'linear',
        complete: function(){ resetimage($(this)); },
        queue: false }
    );
}

function swing(anim_bild, amount,  duration) {
    anim_bild.animate(
        { marginLeft: amount }, {
        duration: duration,
        queue: false,
            complete: function(){ 
                $(this).animate(
                    { marginLeft: 0 }, {
                    duration: duration,
                    queue: false,
                    complete: function(){ swing($(this), amount, duration) }
                    }
                )
            }
        }
    );
}