-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
77 lines (65 loc) · 2.61 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function toggleSearch() {
var searchIcon = document.querySelector(".search-icon i");
var searchForm = document.getElementById("searchForm");
if (searchForm.style.display === "block") {
searchForm.style.display = "none";
searchIcon.style.display = "inline";
} else {
searchForm.style.display = "block";
searchIcon.style.display = "none";
}
}
function showSearchForm() {
var searchIcon = document.querySelector(".search-icon i");
var searchForm = document.getElementById("searchForm");
searchForm.style.display = "block";
searchIcon.style.display = "none";
}
function hideSearchForm() {
var searchIcon = document.querySelector(".search-icon i");
var searchForm = document.getElementById("searchForm");
searchForm.style.display = "none";
searchIcon.style.display = "inline";
}
function toggleProfileMenu() {
var profileMenu = document.getElementById("profileMenu");
if (profileMenu.style.display === "block") {
profileMenu.style.display = "none";
} else {
profileMenu.style.display = "block";
}
}
// Close the profile menu when clicking outside
document.addEventListener("click", function(event) {
var searchIcon = document.querySelector(".search-icon i");
var searchForm = document.getElementById("searchForm");
var isSearchIconClicked = event.target.closest(".search-icon");
var isSearchFormClicked = event.target.closest(".search-form");
if (!isSearchFormClicked && !isSearchIconClicked) {
searchForm.style.display = "none";
searchIcon.style.display = "inline";
}
var profileMenu = document.getElementById("profileMenu");
var profileIcon = document.querySelector(".profile i");
var isProfileClicked = event.target.closest(".profile");
if (!isProfileClicked) {
profileMenu.style.display = "none";
}
});
window.addEventListener('scroll', function() {
const navbar = document.querySelector('.nav');
navbar.classList.toggle('scrolled', window.scrollY > 0);
});
const slider = document.querySelector('.slider');
let isHoveringSlider = false;
// Get all movie slides
const movieSlides = document.querySelectorAll('.swiper-slide');
// Add event listeners for each movie slide
movieSlides.forEach(movieSlide => {
movieSlide.addEventListener('mouseenter', function() {
this.style.opacity = '1'; // Make the movie slide fully visible
});
movieSlide.addEventListener('mouseleave', function() {
this.style.opacity = '0.5'; // Restore the original opacity
});
});