Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added the navbar and fixed the width of primary-btns #94

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
<title>Giphy Search | @lcrojano</title>
</head>

<body class="flex-col align-items-center">
<div id="github-link">
<body class="flex-col align-items-center">
<div id="github-link">
<a href="https://github.com/lcrojano/Giphy_Explorer" target="_blank">
<img src="assets/images/github-mark-white.png" alt="GitHub" />
<h1>Fork Me</h1>
Expand Down Expand Up @@ -124,8 +124,16 @@ <h1 class="grow-2" id="logo">Giphy Search</h1>
<img src="./assets/images/heart.png" alt="favorites" width="30" />
</a>
</button>
</div>
</div>
</section>
<nav class="navbar">
<div id="github-link">
<a href="https://github.com/lcrojano/Giphy_Explorer" target="_blank">
<img src="assets/images/github-mark-white.png" alt="GitHub" />
<h1>Fork Me</h1>
</a>
</div>
</nav>

<!-- Update the modal for sharing GIFs -->
<section class="modal" id="modal-overlay">
Expand Down
13 changes: 13 additions & 0 deletions scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,19 @@ const loadGifs = async (url, callback) => {
return gifs.data;
};

/** navbar **/
const navbar = document.querySelector('.navbar');

window.addEventListener('scroll', () => {
if (window.scrollY > 50) { // Adjust the value for when the navbar should appear
navbar.classList.add('visible-navbar');
navbar.classList.remove('hidden-navbar');
} else {
navbar.classList.remove('visible-navbar');
navbar.classList.add('hidden-navbar');
}
});

/**Search */

const searchEvent = (e, giphyObj) => {
Expand Down
35 changes: 35 additions & 0 deletions styles/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,19 @@ h1 {

.logo {
position: relative;
z-index: 101;
}

.logo-link {
text-decoration: none;
color: var(--primary-text-color);
z-index: 101;
}

.fixedlogo {
position: fixed;
top: -60px;
z-index: 101;
}

.show {
Expand Down Expand Up @@ -113,6 +116,7 @@ h1 {
transition-delay: 2s;
transform: translateX(40%);
transition: transform 0.4s ease;
z-index: 101;
}

input[type='search'] {
Expand Down Expand Up @@ -280,6 +284,34 @@ figure img {
position: fixed;
}

.navbar{
position: fixed;
top: 0;
left: 0;
right: 0;
width: 98%;
max-width: 100%;
display: block;
justify-content: space-between;
padding: 3em 1%;
background-color: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(25px);
-webkit-backdrop-filter: blur(25px);
transition: transform 0.5s ease;
}
.hidden-navbar {
transform: translateY(-100%); /* Moves navbar out of view */
}

.visible-navbar {
transform: translateY(0); /* Brings navbar into view */
}

/* Make the logo responsive */
.navbar .logo {
max-height: 80%; /* Keeps the logo within the navbar without stretching */
z-index: 101;
}
.primary-btn {
background: linear-gradient(
45deg,
Expand All @@ -289,6 +321,8 @@ figure img {
border-radius: 4px;
overflow: hidden;
cursor: pointer;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
min-width: 50px;
}

.secondary-btn {
Expand All @@ -300,6 +334,7 @@ figure img {
cursor: pointer;
font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
font-weight: bolder;
box-shadow: 0px 4px 6px rgba(0, 0, 0, 0.1);
}


Expand Down