SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict ketting00's Avatar
    Join Date
    Jul 2011
    Posts
    325
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    How to detect if there is a scroll bar on the right

    Hi all,

    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.

    Thanks

    Edit: I've used iframe shim as placeholder

  2. #2
    SitePoint Member PaulPov's Avatar
    Join Date
    Dec 2011
    Location
    Saint-Petersburg, Russia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PaulPov View Post
    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.
    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).
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }

  4. #4
    SitePoint Member PaulPov's Avatar
    Join Date
    Dec 2011
    Location
    Saint-Petersburg, Russia
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks! I'll try that =)


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •