Team:Heidelberg/Team

From 2013.igem.org

(Difference between revisions)
m
Line 105: Line 105:
     var picsperHeight = Math.ceil(($('.teamimage').length - 2 * picsperWidth) / 2) + 2;
     var picsperHeight = Math.ceil(($('.teamimage').length - 2 * picsperWidth) / 2) + 2;
     return {h: picsperWidth, v: picsperHeight};
     return {h: picsperWidth, v: picsperHeight};
 +
}
 +
 +
function startAnimation()
 +
{
 +
    $('#memberdesc').hide();
 +
    var images;
 +
    if (arguments.length > 0)
 +
        images = arguments[0];
 +
    else
 +
        images = $('.teamimage');
 +
    if (typeof(lastclicked) == 'undefined' || new Date() - lastclicked >= arguments[2]) {
 +
        for (var i = 0; i < images.length; ++i) {
 +
            var leftpos = Math.random() * width;
 +
            var toppos = Math.random() * height;
 +
            $(images[i]).css({"left": leftpos, "top": toppos});
 +
        }
 +
        for (var i = 0; i < images.length; ++i) {
 +
            animateDiv.call(images[i]);
 +
        }
 +
    }
}
}
Line 115: Line 135:
         if (animated)
         if (animated)
             stopAnimation();
             stopAnimation();
 +
        lastclicked = new Date();
 +
        timeout = 60 * 1000;
 +
        setTimeout(function(){startAnimation(images, timeout);}, timeout);
         var panel = $('#memberdesc');
         var panel = $('#memberdesc');
         panel.find("h3").empty().text($(e.delegateTarget).attr("data-name"));
         panel.find("h3").empty().text($(e.delegateTarget).attr("data-name"));
Line 120: Line 143:
         panel.fadeIn();
         panel.fadeIn();
     });
     });
-
     for (var i = 0; i < images.length; ++i) {
+
     startAnimation();
-
        var leftpos = Math.random() * width;
+
-
        var toppos = Math.random() * height;
+
-
        $(images[i]).css({"left": leftpos, "top": toppos});
+
-
    }
+
-
    for (var i = 0; i < images.length; ++i) {
+
-
        animateDiv.call(images[i]);
+
-
    }
+
});
});

Revision as of 22:50, 4 October 2013