Created
February 26, 2015 03:06
-
-
Save carjug/881e6202e7f17c5bf11a to your computer and use it in GitHub Desktop.
My Crystal Ball Game
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@font-face { | |
font-family:'yesterdays_mealregular'; | |
src: url('fonts/YESTERDAYSMEAL-webfont.eot'); | |
src: url('fonts/YESTERDAYSMEAL-webfont.eot?#iefix') format('embedded-opentype'), | |
url('fonts/YESTERDAYSMEAL-webfont.woff') format('woff'), | |
url('fonts/YESTERDAYSMEAL-webfont.ttf') format('truetype'), | |
url('fonts/YESTERDAYSMEAL-webfont.svg#yesterdays_mealregular') format('svg'); | |
font-weight: normal; | |
font-style: normal; | |
} | |
@font-face { | |
font-family: '2dumbregular'; | |
src: url('fonts/2Dumb-webfont.eot'); | |
src: url('fonts/2Dumb-webfont.eot?#iefix') format('embedded-opentype'), | |
url('fonts/2Dumb-webfont.woff') format('woff'), | |
url('fonts/2Dumb-webfont.ttf') format('truetype'), | |
url('fonts/2Dumb-webfont.svg#2dumbregular') format('svg'); | |
font-weight: normal; | |
font-style: normal; | |
} | |
@font-face { | |
font-family: '3dumbregular'; | |
src: url('fonts/3Dumb-webfont.eot'); | |
src: url('fonts/3Dumb-webfont.eot?#iefix') format('embedded-opentype'), | |
url('fonts/3Dumb-webfont.woff') format('woff'), | |
url('fonts/3Dumb-webfont.ttf') format('truetype'), | |
url('fonts/3Dumb-webfont.svg#3dumbregular') format('svg'); | |
font-weight: normal; | |
font-style: normal; | |
} | |
header { | |
font-family: '3dumbregular'; | |
font-size: 2.75em; | |
width: auto; | |
height: 3.2em; | |
padding-top: -.45em; | |
} | |
body { | |
text-align: center; | |
background: url("http://photographyofgrace.com/3dTextures/LargeBackgrounds/BlueLinedPaperBackground.jpg") fixed no-repeat center center; | |
} | |
.class1 { | |
font-family: '2dumbregular'; | |
} | |
.question { | |
width: 13em; | |
height: 2.5em; | |
border-radius: .5em; | |
margin-top: 2.5em; | |
margin-bottom: 1.25em; | |
} | |
#ask { | |
width: 5.75em; | |
height: 2.85em; | |
border-radius: .5em; | |
background-color: white; | |
font-family: '2dumbregular'; | |
font-size: 14px; | |
cursor: pointer; | |
} | |
#ask:hover { | |
background-color: #FFE400; | |
} | |
#answer { | |
font-family: '3dumbregular'; | |
font-size: 3em; | |
margin-top: -8.5px; | |
margin-bottom: 25px; | |
} | |
#fortune { | |
border: transparent; | |
background: transparent; | |
font-family: '2dumbregular'; | |
font-size: 20px; | |
} | |
#guy { | |
height: 20em; | |
width: 25em; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype HTML> | |
<head> | |
<title>Crystal Ball</title> | |
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/themes/smoothness/jquery-ui.css"/> | |
<link rel="stylesheet" type="text/css" href="magic8Ball.css"> | |
</head> | |
<body> | |
<header> | |
<h1>CRYSTAL BALL</h1> | |
</header> | |
<main class="main"> | |
<section class="class1"> | |
<h2>Ask the Crystal Ball a 'yes' or 'no' question</h2> | |
<form> | |
<input type="text" class="question" placeholder="Type your question here"></input> | |
</form> | |
<button type="button" id="ask">Ask</button> | |
</section> | |
<section> | |
<h1 id="answer">Crystal Ball says:</h1> | |
<p id="fortune"><p> | |
</section> | |
<article> | |
<img src="http://www.arttherapyblog.com/uimages/2012/06/crystal-ball-art-therapy-300x270.jpg" id="guy"/></img> | |
</article> | |
</main> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"> | |
</script> | |
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.3/jquery-ui.min.js"></script> | |
<script src="magic8Ball.js"></script> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$("#ask").on('click', function() { | |
var number = Math.floor(Math.random() * 9); | |
console.log(number); | |
$("#answer").effect("shake"); | |
var one = "In your dreams!", | |
two = "Looking hopeful", | |
three = "50/50 chance", | |
four = "Without a doubt!", | |
five = "Ask again later", | |
six = "Not likely", | |
seven = "Absolutely not!", | |
eight = "You bet", | |
nine = "I'm bored with this question, ask another", | |
ten = "100% yes"; | |
if($(".question").val()==""){ | |
$("#fortune").text("You need to input a question!"); | |
} | |
else { | |
if(number == 0){ | |
$("#fortune").text(one); | |
} | |
else if(number == 1){ | |
$("#fortune").text(two); | |
} | |
else if(number == 2){ | |
$("#fortune").text(three); | |
} | |
else if(number == 3){ | |
$("#fortune").text(four); | |
} | |
else if(number == 4){ | |
$("#fortune").text(five); | |
} | |
else if(number == 5){ | |
$("#fortune").text(six); | |
} | |
else if(number == 6){ | |
$("#fortune").text(seven); | |
} | |
else if(number == 7){ | |
$("#fortune").text(eight); | |
} | |
else if(number == 8){ | |
$("#fortune").text(nine); | |
} | |
else if(number == 9){ | |
$("#fortune").text(ten); | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment