A
A
AhmedGasem2016-11-05 20:13:03
css
AhmedGasem, 2016-11-05 20:13:03

How to snap the menu to the top when scrolling the page?

I want the menu to remain visible when scrolling down the page, and not go up
d75d9fa5a04c41af85270b6a363518d5.jpg
Please help =) If there is some class in the bootstrap or via css somehow? I will be very grateful =)
PS Thank you!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Skogorev, 2016-11-05
@EnterSandman

Is this your first freelancing assignment?
Tryposition: fixed;

N
Nikolai Astrakhantsev, 2016-11-05
@ihexy

For example, a menu (.top-navbar) 50px high glued to the screen:

.top-navbar{
position: fixed;
z-index: 10;
top: 0;
left: 0;
right 0:
width: 100%;
height: 50px;
}

More correct for your case (on bootstrap):
<nav class="navbar navbar-default navbar-fixed-top" role="navigation" data-spy="affix" data-offset-top="50">
  <div class="container">
    ...
  </div>
</nav>

Will need to work with .affix in CSS

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question