July 21, 2010

Disable Scrollbar conditionally without javascript

Question by Mac

i want to hide the scrollbar conditionally i.e. i want to hide the scrollbar of the body when javascript is disabled and enabling it when javascript is enabled because in my page iam showing an message when javascript is disabled and not allowing to user to do anything by graying out the whole screen but as the height for different pages are different so iam using a big height in that case the scrollbar is creating problem in case of small height pages.

Answer by Starx

try this

<noscript>
     <style>
         body { width:100%; hight: 100%; overflow:hidden; }
     </style>
</noscript>

Author: Nabin Nepal (Starx)

Hello, I am Nabin Nepal and you can call me Starx. This is my blog where write about my life and my involvements. I am a Software Developer, A Cyclist and a Realist. I hope you will find my blog interesting. Follow me on Google+

...

Please fill the form - I will response as fast as I can!