Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position fixed and width 100% element covering vertical scrollbar in IE

I have a div with WIDTH 100% and position fixed on the top of the page. It covers the vertical scrollbar in IE when vertical scrolling is needed on the html.

What can I do to avoid this (I can't change the position fixed bit)?

Can I detect whether page need vertical scrolling onload/resize and change that static div's width using jQuery?

or

Solve it through CSS altogether?

like image 532
bcm Avatar asked Aug 04 '10 01:08

bcm


2 Answers

Found the problem: I accidentally attached overflow:auto on the body tag when it was only meant for the html tag.

like image 67
bcm Avatar answered Sep 22 '22 07:09

bcm


It is kinda hard to tell without seeing the page, but could you add a conditional stylesheet and move the div over 5px or so in ie so that doesn't happen? right:5px

The jquery code for this would be something like:

if ($(window).height() < $(document).height()) {
   $('#myDiv').css('left', '5px');
}
like image 43
CEich Avatar answered Sep 19 '22 07:09

CEich