Skip to content

Instantly share code, notes, and snippets.

@Ahnita Ahnita/kitties.js
Last active Aug 29, 2015

Embed
What would you like to do?
JS
var myKitties = [ { title: "Moderne Manila", pic: "https://www.petfinder.com/wp-content/uploads/2012/09/Blog-Kitty-Cam-solo.jpg" },
{ title: "Second Project", pic: "http://www.animal-photography.com/thumbs/red_tabby_long_hair_kitten_~AP-0UJFTC-TH.jpg" },
{ title: "Third Project", pic: "http://www.animal-photography.com/thumbs/silver_tabby_kittens~AP-0JO6Y9-TH.jpg" },
];
$(document).ready(function(){
for (var i=0; i<myKitties.length; ++i) {
$("#" + i).css("background-image", "url(" + myKitties[i].pic + ")");
};
$(".image").mouseenter( function () {
console.log(this);
$(this).html("<p class='info'><span class='proj-title'>Title:</span>" + myKitties[
this.id].title + "</p>");
}).mouseleave( function () {
$("p.info").html("");
});
});
});
$(document).ready(function() {
$('textarea').css('background-color', 'white');
$("#submit").on("click", function(){
console.log("clicked");
});
$('.message-box').on("keyup", function(){
console.log("keyup happened");
var charCount = $(".message-box").val().length;
console.log(charCount);
$("#char-count").html(charCount);
if (charCount > 50) {
$("#char-count").css("color", "red");
}else {
$("#char-count").css("color", "black");
}
if (charCount >= 149) {
alert("Please do not exceed 150 characters");
}
});
for (var i=0; i<rows.length; ++i) {
if (i%2===0) {
$("tr:odd").addClass("odd");
};
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.