Skip to content

Instantly share code, notes, and snippets.

View jensechu's full-sized avatar

Jensen Kuras jensechu

View GitHub Profile
$(".fish").draggable({
drag: function() {
$("#picture img").attr({ src: "images/kitty_hungry.png" });
revert: true;
},
stop: function () {
if($("#picture img").hasClass("eating")) {
setTimeout(reset_kitty, 2000);
}
else {
$("#picture img").droppable({
drop: function() {
$(this).attr({ src: "images/kitty_nom.png" });
$(this).addClass("eating");
$(".fish").hide();
}
});
<div id="food">
<p>nom nom nom</p>
<img src="images/nomnom.png"></img>
<img class="fish" src="images/fish.png"></img>
</div>
<div id="picture">
<img src="images/kitty.png"></img>
</div>
$(document).ready(function(){
var furs = ["#FFFFFF", "#F7941D", "#EBEBEB", "#636363", "#C69C6D", "#A186BE", "395A00", "#FFF220"];
$("#picture img").click(function () {
var choice = Math.floor(Math.random()*furs.length);
$(this).css({ "background-color" : furs[choice] });
});
$(document).ready(function(){
var furs = ["#FFFFFF", "#F7941D", "#EBEBEB", "#636363", "#C69C6D", "#A186BE", "395A00", "#FFF220"];
$("#picture img").click(function () {
var choice = Math.floor(Math.random()*furs.length);
$(this).css({ "background-color" : furs[choice] });
});
$(document).ready(function(){
var furs = ["#FFFFFF", "#F7941D", "#EBEBEB", "#636363", "#C69C6D", "#A186BE", "395A00", "#FFF220"];
$("#picture img").click(function () {
var choice = Math.floor(Math.random()*furs.length);
$(this).css({ "background-color" : furs[choice] });
});