Im trying to make navbar responsive, but it does not stick to the top when I scroll down as you can see the picture below, it just stays at the top and disappears as i scroll down just like a normal div (I scrolled a little bit from the top)
what am I missing ?
my GitHub repo
EDIT: there is no problem with desktop version
my HTML of navbar
<div
className='navbar'
style={{ transition: 'ease-in-out 0.5s', backgroundColor: bgColor }}
>
<div className='navbar-wrapper'>
<div className='left'>
<img src={myLogo} alt='logo' />
<span id='name'>Suat Bayrak</span>
</div>
<div className='right'>
<i className='fas fa-bars' onClick={(e) => menuFunc(e)}></i>
<ul className={showMenu ? 'active' : ''}>
<li>
<NavLink to='/' exact activeClassName='active'>
Home
</NavLink>
</li>
<li>
<NavLink to='/about' exact activeClassName='active'>
About
</NavLink>
</li>
<li>
{' '}
<NavLink to='/portfolio' exact activeClassName='active'>
Porfolio
</NavLink>
</li>
<li>
<NavLink to='/contact' exact activeClassName='active'>
Contact
</NavLink>
</li>
</ul>
</div>
</div>
</div>
here is my CSS
@media only screen and (min-device-width: 320px) and (max-device-width: 767px) {
.navbar {
position: fixed;
z-index: 199;
top: 0;
}
.navbar .navbar-wrapper {
width: 100%;
}
.navbar .navbar-wrapper .left {
border: 1px solid white;
width: 25%;
}
.navbar .navbar-wrapper .left #name {
font-size: 24px;
}