Is there any way I can detect if there is a scroll bar on the right of my web page.
I use a javascript drop down menu and position it precisely with certain pixel count. It’s a photo gallery.
However, if the picture has an extra size, the menu looks ugly with a scroll bar on the right. I’ve tried every method found on Google search but it’s not working.
Do you have any idea suggestion.
My keywords search are; window height, window width, scroll bar detection, and many, many more I can remember it all.
I ended up with tweaking Wordpress CSS to solve this. What annoyed me was that the page jumped (shifted) a bit when switching between a long page, that had an automatic scroll, to a short one that didn’t show the scroll. To be frank, I didn’t find a great solution and decided that the best thing would be having scrollbars on all pages. So I made html and body css height and min-height 101% (100.1% didn’t work in Opera). You can see a short page still having a scrollbar here - http://brand-mauer.com/en/portfolio Now I don’t have to think about whether there’s a scrollbar or not. I know it’s always there. Hope this helps.
If you set overflow-y:scroll; on the body it should always show a scrollbar (even when there is no scroll needed, it will should show an empty scrollbar).