Skip to content

Instantly share code, notes, and snippets.

@isabellatea
Created February 8, 2019 01:10
Show Gist options
  • Save isabellatea/e169d61bf3f512959017aa7aa3cbdf0c to your computer and use it in GitHub Desktop.
Save isabellatea/e169d61bf3f512959017aa7aa3cbdf0c to your computer and use it in GitHub Desktop.
Solution Code for FunWithJQuery Project
$(document).ready(function(){
// all jQuery methods go here...
//CHALLENGE - together
//runningman
$("#runningman-img").hover(runningmanGiphy, runningmanIcon)
function runningmanGiphy() {
this.src = 'images/runningman-giphy.gif';
}
function runningmanIcon() {
this.src = 'images/runningman-icon.png';
}
//take the L
$("#taketheL-img").hover(taketheLGiphy, taketheLIcon)
function taketheLGiphy() {
this.src = 'images/taketheL-giphy.gif';
}
function taketheLIcon() {
this.src = 'images/taketheL-icon.png';
}
//electro shuffle
$("#electroshuffle-img").hover(electroshuffleGiphy, electroshuffleIcon)
function electroshuffleGiphy() {
this.src = 'images/electroshuffle-giphy.gif';
}
function electroshuffleIcon() {
this.src = 'images/electroshuffle-icon.png';
}
//bestmates
$("#bestmates-img").hover(bestmatesGiphy, bestmatesIcon)
function bestmatesGiphy() {
this.src = 'images/bestmates-giphy.gif';
}
function bestmatesIcon() {
this.src = 'images/bestmates-icon.png';
}
//CHALLENGE #1 - DOM Manipulation (Change the title from “Fortnite Emotes!” to anything you want)
$("#title").html("My Emotes!")
//CHALLENGE #2 - DOM Manipulation (Remove the element with id “extra-text”)
$("#extra-text").remove();
//CHALLENGE #3 - Event Handling (On click of the Fortnite logo, change the bg to “bg2.jpg”)
$("#logo").click(changeBackground);
function changeBackground() {
$("body").css("background-image", "url(images/bg2.jpg)")
}
//CHALLENGE #4 - Event Handling (On click of the emote titles, hide/show the emote information)
$("#runningman-name").click(runningManToggle);
function runningManToggle() {
$("#runningman-info").slideToggle();
}
$("#taketheL-name").click(taketheLToggle);
function taketheLToggle() {
$("#taketheL-info").slideToggle();
}
$("#electroshuffle-name").click(electroshuffleToggle);
function electroshuffleToggle() {
$("#electroshuffle-info").slideToggle();
}
$("#bestmates-name").click(bestmatesToggle);
function bestmatesToggle() {
$("#bestmates-info").slideToggle();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment