Skip to content

Instantly share code, notes, and snippets.

@winnab
Created April 26, 2015 13:12
Show Gist options
  • Save winnab/142eecb89d6ee717d365 to your computer and use it in GitHub Desktop.
Save winnab/142eecb89d6ee717d365 to your computer and use it in GitHub Desktop.
main
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