-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
55 lines (44 loc) · 1.68 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
const bar = document.getElementById('bar');
const close = document.getElementById('close');
const nav = document.getElementById('nav');
if (bar) {
bar.addEventListener('click', () => {
console.log('Hamburger clicked');
nav.classList.add('active');
});
}
if (close) {
close.addEventListener('click', () => {
nav.classList.remove('active'); // Remove the 'active' class when close icon is clicked
});
}
let next = document.querySelector('.next')
let prev = document.querySelector('.prev')
next.addEventListener('click', function(){
let items = document.querySelectorAll('.item')
document.querySelector('.slide').appendChild(items[0])
})
prev.addEventListener('click', function(){
let items = document.querySelectorAll('.item')
document.querySelector('.slide').prepend(items[items.length - 1]) // here the length of items = 6
})
// Function to play the video when hovered over
document.querySelector("#video-player").addEventListener("mouseenter", function() {
this.play();
});
// Function to pause the video when not hovered over
document.querySelector("#video-player").addEventListener("mouseleave", function() {
this.pause();
});
// Function to play the video when hovering over the thumbnail
function playVideo() {
// Show the video player
document.querySelector("#video-player").style.display = "block";
// Start playing the video
document.querySelector("#video-player").play();
}
// Function to pause the video when mouse leaves the thumbnail
function pauseVideo() {
// Pause the video
document.querySelector("#video-player").pause();
}