Jquery floating point menu bar

I try to constantly float the menu bar at the top of the browser, so when they scroll down the page, the menu bar remains at the top.

How can i do this?

Hi,

+3
source share
2 answers

You can do this using the CSS position property. For instance:

#menu {
  height: 50px;
  left: 0;
  position:fixed;
  top: 0;
}

Literature:

The first thing I noticed is that it is effectively used on the Perldoc site. If you need to scroll, the #content_header element uses a combination of CSS and JS to keep the element visible on the page.

+3
source

CSS position: fixed; , . , top/right/bottom/left, . z-index , "". z-index of 1 a z-index, 100.

div.float {
    position: fixed;
    top: 10px;
    left: 25px;
    z-index: 9001;
}

jsfiddle.net , . , , : http://jsfiddle.net/2rhrc/

+7

Source: https://habr.com/ru/post/1764605/


All Articles