6

I want to display a "Go to top"-Link on my website. This link should only be visible, if the vertical scrollbar is visible.

How can I do this using JavaScript?

Thanks

Ben
  • 54,723
  • 49
  • 178
  • 224
brainfck
  • 9,286
  • 7
  • 28
  • 29
  • 2
    this is a duplicate http://stackoverflow.com/questions/2175992/detect-when-window-vertical-scrollbar-appears – corroded May 28 '10 at 09:43
  • possible duplicate of [Detect if a page has a vertical scrollbar?](http://stackoverflow.com/questions/2146874/detect-if-a-page-has-a-vertical-scrollbar) – Andy E May 28 '10 at 09:52

1 Answers1

8

you can check elem.clientHeight < elem.scrollHeight value but it also depends of css properties

user352741
  • 96
  • 1