-6

I have a need to make a hidden div element shown in an user event, in the visible top.

What I mean by visible top is, - Its 0 if page is not scrolled - if page is scrolled then I need coordinate of visible top, not the page top

Can that be set static with CSS or how to calculate it with jQuery or pure js.

Best Regards

GUIR
  • 71
  • 2
  • 7

1 Answers1

0

You can do it with just plain css:

div {
   position: fixed;
   top: 0;
   display: none;
}

This will always be on top: 0 regardless of whether it is scrolled or not.

Serkan Sipahi
  • 691
  • 6
  • 19