Skip to content

Instantly share code, notes, and snippets.

@Ahnita
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ahnita/4929040c2f287b65fd13 to your computer and use it in GitHub Desktop.
Save Ahnita/4929040c2f287b65fd13 to your computer and use it in GitHub Desktop.
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