Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
  • Loading branch information
pirateIV committed Jul 28, 2023
1 parent 8f29414 commit d7b6860
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
10 changes: 8 additions & 2 deletions js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const api_popular_list = `https://api.themoviedb.org/3/discover/movie?api_key=5e
// airing today movies
const api_air_today = `https://api.themoviedb.org/3/tv/airing_today?api_key=${api_key}`;

const youtube_watch = `https://www.youtube.com/watch?v=`

async function getGenres() {
const res = await fetch(
"https://api.themoviedb.org/3/genre/movie/list" + "?api_key=" + api_key
Expand Down Expand Up @@ -72,7 +74,7 @@ async function getMovieDetails(movieContent, index) {
<img src="${
img_path + poster_path
}" alt="" class="img-fluid" style="width: 31%">
${id}
<div>
<h1 class="text-white">${title}</h1>
<section class="mt-5 d-flex justify-content-center flex-column">
Expand All @@ -94,7 +96,7 @@ async function getMovieDetails(movieContent, index) {
<p>${release_date}</p>
</div>
<button id="fullMovieBtn">Full Movie Details</button>
<button id="fullMovieBtn"></button>
</section>
</div>
Expand All @@ -117,6 +119,7 @@ async function getMovieDetails(movieContent, index) {
const fullMovieBtn = document.getElementById('fullMovieBtn')
fullMovieBtn.addEventListener('click', () => {
getMovieFullDetails(id)
navigateToDestination(id)
})
// Close Movie Details Icon
const closeIcon = document.querySelector(".close-btn");
Expand Down Expand Up @@ -156,3 +159,6 @@ function getMovieFullDetails(movie_id) {
});
}

function navigateToDestination(video_key) {
window.location.href = `movies.html?videoKey=${video_key}`
}
17 changes: 17 additions & 0 deletions js/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const navToggle = document.getElementById("nav-toggle");
const navUl = document.querySelector("#nav-links")
const navLinks = document.querySelectorAll("#nav-links li")
const navLinksAnchor = document.querySelectorAll("#nav-links li a")

navToggle.addEventListener('click', (e) => {
// navUl.style.height = 0
navLinks.forEach((link, idx) => {
link.style.height = 0;
console.log(link.getBoundingClientRect().height)
})
navLinksAnchor.forEach((anchor, idx) => {
console.log(anchor.getBoundingClientRect().height)
})

e.preventDefault()
})
5 changes: 3 additions & 2 deletions movies.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
/></a>

<i
class="fas fa-bars text-white ps-4 d-lg-none d-flex order-lg-0"
class="fas fa-bars text-white ps-4 d-lg-none d-flex order-lg-0" id="nav-toggle"
></i>
<ul
class="nav-links nav d-lg-flex align-items-center gap-4 order-lg-0"
class="nav-links nav d-lg-flex align-items-center gap-4 order-lg-0 overflow-hidden" id="nav-links"
>
<li>
<a
Expand Down Expand Up @@ -120,5 +120,6 @@
</main>

<script src="js/movies.js"></script>
<script src="js/utils.js"></script>
</body>
</html>

0 comments on commit d7b6860

Please sign in to comment.