CSS fixed positions

I have asked this question before but the answer did not hold up.

I have a menu on the left side of my website that has a fixed position.  So, no matter how far I scroll up or down the page, the menu is always in the same place on the left side of page.  However, If I change the size of my screen and scroll horizontally,  it will begin to overlap the content of the page. it slides under the other content.

Is there a way to keep a div fixed vertically but not fixed horizontally so it can move with the entire page as you scroll right and left?
LVL 8
rgranlundAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

LZ1Commented:
Unfortunately not really. Not with pure CSS anyways. You may need a custom Javascript solution.
0
rgranlundAuthor Commented:
@LZ1  like what?  any clues that can put me in the correct direction?
0
LZ1Commented:
I've been looking, but haven't seen any type of solution.  Let me make sure I have the right thing in mind though. Your talking about having a fixed div on the left hand side. The everything else on the right. When a user has to scroll horizontally though, it should move as if it's part of the page?

What about something like framesets? http://www.w3schools.com/tags/tag_frameset.asp
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

rgranlundAuthor Commented:
@LZ1  Yes that is correct but the frameset is not a good choice at this point.
0
LZ1Commented:
Understandable. I wouldn't want to use it either honestly.  

Have you seen any place this is done before? We may be able to take a sneak peek at their code to see how it can be done.
0
LZ1Commented:
I just found this and tested. For the fixed-element, just insert the ID of whatever div your trying to target.
<script type='text/javascript'>

window.onscroll = fixedYPos( 'fixed-element' );

function fixedYPos( elemId )
{
  var elem = document.getElementById( elemId ),
      xInit = elem.offsetLeft,
      de = document.documentElement;
  
  return function()
  {          
    elem.style.left = xInit - ( window.pageXOffset || de.scrollLeft ) + 'px';      
  }
}

</script>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.