Skip to content

Instantly share code, notes, and snippets.

@matthewnolan
Created August 1, 2014 15:36
Show Gist options
  • Save matthewnolan/6f3c457eaee696246375 to your computer and use it in GitHub Desktop.
Save matthewnolan/6f3c457eaee696246375 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/normalize.min.css">
<link rel="stylesheet" href="css/main.css">
<style>
#holder {
max-height: 300px;
overflow: scroll;
}
#holder article {
display: none;
background-color: #ccc;
margin: 5px;
padding:6px;
width:400px;
opacity: 1;
-webkit-animation: myfirst 1s;
}
@-webkit-keyframes myfirst {
from {opacity: 0}
to {opacity: 1}
}
</style>
<script src="js/vendor/modernizr-2.6.2.min.js"></script>
</head>
<body>
<div id="holder"></div>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.11.0.min.js"><\/script>')</script>
<script src="js/main.js"></script>
<script src="js/vendor/mustache.js"></script>
<script>
// Matt Nolan won $500 on a $35 bet in Golden Goddess...
var userInfo = [
{
name: "Matthew Nolan",
won: 500,
bet: 35,
game: "Golden Goddess"
},
{
name: "Guy Shahar",
won: 333,
bet: 3,
game: "Zen Panda"
},
{
name: "Batman",
won: 736,
bet: 363,
game: "Cats"
}
]
$(function(){
var holder = $("#holder");
var firstChild = $("#holder article:first-child");
function loadStory(name,won,bet,game){
holder.prepend("<article>" + name + " won $" +won+ " on a $" + bet + " in " + game);
$("#holder article:first-child").slideDown('fast',function(){
// this.
}).fadeIn();;
}
// loadStory(name,won,bet,game)
// console.log(userInfo[0].name);
var count = 0;
var interval = function(){
return Math.floor((Math.random() * 2000) + 100);
}
(function loop() {
var rand = Math.round(Math.random() * (3000 - 33)) + 33;
setTimeout(function() {
if (count==userInfo.length) count = 0;
loadStory(userInfo[count].name,rand,userInfo[count].bet,userInfo[count].game);
count++
loop();
}, rand);
}());
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment