From 222ae26549304124683bbe7e1479eed29517c743 Mon Sep 17 00:00:00 2001 From: Douglas Muth Date: Sun, 26 Apr 2015 16:02:56 -0400 Subject: [PATCH] Added fade out of rows and configurable delay. --- main.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index f7a0f56..be6461b 100644 --- a/main.js +++ b/main.js @@ -56,19 +56,27 @@ jQuery(".dice_button").on("click", function(e) { /** * This function displays each dice roll. * +* @param array rows Array of rows of dice rolls that we had. +* @param object cb Our callback to fire when done * */ function display_row(rows, cb) { + var duration = 250; + var fadein_delay = 500; + if (rows.length) { // // Display a row, then call ourselves again then done. // var row = rows.shift(); - row.hide().appendTo(".results").fadeIn(500, function() { - jQuery(".results").append("
"); - display_row(rows, cb); - }); + var tmp = row.hide().appendTo(".results") + .delay(fadein_delay) + .fadeIn(duration, function() { + jQuery(".results").append("
"); + display_row(rows, cb); + }) + .delay(1000).fadeOut(duration); } else { //