Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 36 additions & 14 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,46 @@ $(document).ready(function() {
});

// Toggle to expand or hide all of the movie/show names by clicking an icon
$(".btn-reveal-all").click(function () {
$(this).toggleClass(["revealed"]);
const emojis = $("#emojis").find(".emoji-card-title");
if ($(this).hasClass("revealed")) {
emojis.removeClass("hide-card");
// $(".btn-reveal-all").click(function () {
// $(this).toggleClass(["revealed"]);
// const emojis = $("#emojis").find(".emoji-card-title");
// if ($(this).hasClass("revealed")) {
// emojis.removeClass("hide-card");
// } else {
// emojis.addClass("hide-card");
// }
// let title = $(this).attr("title");
// title =
// title.search(/reveal/i) === -1
// ? title.replace(/hide/i, "Reveal")
// : title.replace(/reveal/i, "Hide");
// $(this).attr("title", title);

// $(this).find("i").toggleClass(["fa-eye", "fa-eye-slash"]);
// });

// Toggle to expand or hide all of the movie/show names by clicking an icon converted to javascript
document.querySelector(".btn-reveal-all").addEventListener("click", function () {
this.classList.toggle("revealed");
const emojis = document.querySelectorAll("#emojis .emoji-card-title");
const revealed = this.classList.contains("revealed");

emojis.forEach(function (emoji) {
if (revealed) {
emoji.classList.remove("hide-card");
} else {
emojis.addClass("hide-card");
emoji.classList.add("hide-card");
}
let title = $(this).attr("title");
title =
title.search(/reveal/i) === -1
? title.replace(/hide/i, "Reveal")
: title.replace(/reveal/i, "Hide");
$(this).attr("title", title);

$(this).find("i").toggleClass(["fa-eye", "fa-eye-slash"]);
});

let title = this.getAttribute("title");
title = title.search(/reveal/i) === -1 ? title.replace(/hide/i, "Reveal") : title.replace(/reveal/i, "Hide");
this.setAttribute("title", title);

const eyeIcon = this.querySelector("i");
eyeIcon.classList.toggle("fa-eye");
eyeIcon.classList.toggle("fa-eye-slash");
});
//Add a secret code to the project that will trigger a fun animation. If a user types in the word 'emojis' while on the website, emojis will start falling briefly.

//Create an array to store the keys that the user types.
Expand Down