Position "Fixed" moves when scrolling down the page on mobile

Asked

Viewed 73 times

1

Create a div with position:fixed;top:0. In the computer is normal, and does not move independently if I go down or raise the screen, but in the cell phone when I go down the screen it comes out, but if I go up again it appears fixed at the top again. Does anyone know how to solve this? below is the div:

<div class="menu">
  MENU
</div>

.menu{
 position:fixed;
 z-index:9;
 top:0;
 width:100%;
}
  • Are you sure you are position:Fixed? Or is it position:stciky? You use some jQuery or JS in that menu to change the size or something like that when you scroll the screen?

  • But isn’t Fixed going down when you scroll the page? I think what you wanted was Absolute.

  • I discovered the problem. I had a textarea that the width went beyond the screen, so I just fixed the width of it and returned to normal

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.