diff --git a/css/style.css b/css/style.css index c560d55..be52d56 100644 --- a/css/style.css +++ b/css/style.css @@ -217,17 +217,41 @@ img::-moz-selection { font-weight: 400; padding: 0.75em 0; letter-spacing: 1px; - color: white; + + color: #fed136; transition: 0.6s ease; font-family: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif; font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif; } +#mainNav .navbar-nav .nav-item .nav-link::after { + content: ''; + position: absolute; + font-weight:400; + left: 50%; + right: 50%; + bottom: 0px; + width: 0px; + height: 4px; + background: #1b60a5; + transition: all 0.45s; +} + +#mainNav .navbar-nav .nav-item .nav-link:hover::after { +width: 100%; +left:0; + +} + + #mainNav .navbar-nav .nav-item .nav-link.active, #mainNav .navbar-nav .nav-item .nav-link:hover { - color: #fed136; + color: rgb(38, 121, 216); + text-transform: unset; } + + @media (min-width: 992px) { #mainNav { padding-top: 25px; diff --git a/index.html b/index.html index bda4849..a471cf9 100644 --- a/index.html +++ b/index.html @@ -81,16 +81,16 @@ > - - - - `; + `; + + if (output) { + // Scroll to the search result + scrollToResult(output); + } $("#movie").html(output); }) .catch(err => { diff --git a/js/searchMovie.js b/js/searchMovie.js index dd3fb83..5a845ee 100644 --- a/js/searchMovie.js +++ b/js/searchMovie.js @@ -2,66 +2,75 @@ let adultFlag = false; $(document).ready(() => { $("#searchForm").on("submit", e => { let searchText = $("#searchText").val(); - //adultFlag = $('#adult').value(); adultFlag = $("input[name=adult]:checked").val(); getMovies(searchText); e.preventDefault(); - }); + }); }); +function scrollToResult(result) { + if (result) { + // Scroll to the element with the id "movies" where your search results are displayed + document.getElementById("movies").scrollIntoView({ behavior: "smooth" }); + } +} + function getMovies(searchText) { axios .get( "https://api.themoviedb.org/3/search/movie?api_key=ca5d667528ca51e527d9e4f7830d97d2&language=en-US&query=" + searchText + - "&page=1&include_adult=" + + "&page=1&include_adult=" + adultFlag ) .then(response => { let movies = response.data.results; - + let output = ""; + if (movies.length > 0) { $.each(movies, (index, movie) => { output += ` -
- ${ - !movie.poster_path - ? ` - - ${movie.title} - - - ` - : ` - - ${movie.title} - - ` - } -
-

${movie.title}

-

Released On
${movie.release_date}

- Movie Details - -
-
- - `; +
+ ${ + !movie.poster_path + ? ` + + ${movie.title} + + ` + : ` + + ${movie.title} + + ` + } +
+

${movie.title}

+

Released On
${movie.release_date}

+ Movie Details +
+
+ `; }); + + // After rendering the search results, scroll to the "movies" section $("#movies").html(output); + scrollToResult(document.getElementById("movies")); } else { output = - '

No Movie Available with this Name!! Please Try Another Name

'; + `

Oopsie!! We dont have ${searchText}..Please Try Something else..

`; $("#movies").html(output); + scrollToResult(document.getElementById("h2a")); + } }) .catch(err => { diff --git a/js/searchTv.js b/js/searchTv.js index db34414..cbd9fb8 100644 --- a/js/searchTv.js +++ b/js/searchTv.js @@ -10,6 +10,13 @@ $(document).ready(() => { }); }); +function scrollToResult(result) { + if (result) { + result.scrollIntoView({ behavior: "smooth" }); + } +} + + function getMovies(searchText){ axios.get('https://api.themoviedb.org/3/search/tv?api_key=ca5d667528ca51e527d9e4f7830d97d2&language=en-US&query='+searchText+'&page=1') @@ -17,6 +24,10 @@ function getMovies(searchText){ let movies = response.data.results; console.log(response); let output =''; + if (output) { + // Scroll to the search result + scrollToResult(output); + } if(movies.length>0){ $.each(movies, (index, movie) =>{ output += ` @@ -43,6 +54,10 @@ function getMovies(searchText){ `; + if (output) { + // Scroll to the search result + scrollToResult(output); + } }); $('#movies').html(output); } diff --git a/js/tv.js b/js/tv.js index cef4a5b..56809f2 100644 --- a/js/tv.js +++ b/js/tv.js @@ -5,10 +5,19 @@ let searchTitle =''; function movieSelected(id){ sessionStorage.setItem('movieId', id); - window.location = 'singleTv.html'; + window.location.href = 'singleTv.html'; + // window.location.href = `/search-results?query=${encodeURIComponent(query)}`; + return false; } +function scrollToResult(result) { + if (result) { + result.scrollIntoView({ behavior: "smooth" }); + } +} + + function getMovie(){ @@ -88,10 +97,11 @@ function getMovie(){
- - - `; + if (output) { + // Scroll to the search result + scrollToResult(output); + } $('#movie').html(output); }) .catch((err) =>{ diff --git a/movies.html b/movies.html index 85a4768..bf9d738 100644 --- a/movies.html +++ b/movies.html @@ -75,10 +75,10 @@
-

Search for any Movie

+

Search for any Movie,TV Show or Short-Film..

+ placeholder="Search any Movie,TV-Show by Name and Press Enter" />

Are you over 18 years old?

Yes