Created
April 26, 2015 13:12
-
-
Save winnab/142eecb89d6ee717d365 to your computer and use it in GitHub Desktop.
main
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
var image = $('img')[0]; | |
image.src = getRandomCookieImage(); | |
var button = $('button')[0]; | |
button.addEventListener('click', function(e){ | |
hideImage(); | |
}); | |
function getRandomCookieImage() { | |
var imageArray = [ | |
'source/images/cookie1.jpg', | |
'source/images/cookie2.jpg', | |
'source/images/cookie3.jpg', | |
'source/images/cookie4.jpg', | |
'source/images/cookie5.jpg' | |
]; | |
var randomNumber = Math.floor(Math.random() * (4 - 0)); | |
return imageArray[randomNumber] | |
} | |
function hideImage() { | |
var image = $('.group')[0].children[0].children[0]; | |
image.style.display='none'; | |
var aside = $('.group')[0].children[1] | |
aside.style.clear='both' | |
} | |
$('.tick').click(function(){ | |
var icon = this; | |
$(icon).addClass('ticked'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment