Skip to content

Instantly share code, notes, and snippets.

@christurnertv
Last active August 29, 2015 13:57
Show Gist options
  • Save christurnertv/9672586 to your computer and use it in GitHub Desktop.
Save christurnertv/9672586 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Fade Out Sample</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<img src="img/mole.jpg" style="display:none;">
<script>
$('img').click(function () {
$(this).fadeOut();
});
$('img').fadeIn();
</script>
</body>
</html>
<html>
<head>
<title>Awesome Mole Game</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<style>
#game-board {
margin: 10px auto;
width: 456px;
}
.mole-hole {
border: 1px solid black;
float: left;
height: 150px;
width: 150px;
}
img {
height: 150px;
width: 150px;
}
body {
text-align: center;
}
</style>
</head>
<body>
<h1>Awesome Mole Game</h1>
<div id="game-board">
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
</div>
<script>
</script>
</body>
</html>
<html>
<head>
<title>Awesome Mole Game</title>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<style>
#game-board {
margin: 10px auto;
width: 456px;
}
.mole-hole {
border: 1px solid black;
float: left;
height: 150px;
width: 150px;
}
img {
height: 150px;
width: 150px;
display: none;
}
body {
text-align: center;
}
</style>
</head>
<body>
<h1>Awesome Mole Game</h1>
<div id="game-board">
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
<div class="mole-hole">
<img src="img/mole.jpg">
</div>
</div>
<script>
var holes = $('.mole-hole');
var rand = Math.floor(Math.random() * holes.length);
$(holes[rand]).children().fadeIn();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment