added option to turn off light using event listener

This commit is contained in:
Rohithk 2023-10-08 17:16:26 +05:30
commit 644156b52d
2 changed files with 16 additions and 1 deletions

View file

@ -53,6 +53,13 @@ const Movies = () => {
}))
}
}, [id, tmdb]);
useEffect(() => {
document.addEventListener("mousedown", (event) => {
if (event.target !== "iframe") {
switchLight(false)
}
})
}, [])
return (<>
<Head>
<title>Play Movies | Yaps</title>

View file

@ -163,6 +163,14 @@ const Tv = () => {
else if (videoServer.includes("blackvid.space")) setVideoServer(`https://blackvid.space/embed?tmdb=${tmdb}&season=${tvDetails.season}&episode=${tvDetails.episode}`);
}
}, [tvDetails]);
//adding event listener for window to catch left click to remove light setting
useEffect(() => {
document.addEventListener("mousedown", (event) => {
if (event.target !== "iframe") {
switchLight(false)
}
})
}, [])
return (
<>
<Head>
@ -203,7 +211,7 @@ const Tv = () => {
}
}
}}
className={`${prevBtn ? 'block' : 'hidden'} hover:scale-125 transition control-button duration-300 ease-in-out`}/>
className={`${prevBtn ? 'block' : 'hidden'} hover:scale-125 transition control-button duration-300 ease-in-out`}/>
<div
className={"bg-[#222222] absolute left-5 z-50 hidden w-10 text-center tooltip-div"}>
Prev