I'm running into some extremely strange behaviors, and non-consistant across every browser i've tested.
I've a pretty complex layout, but the main issue lies here:
<div id="drop">
<div id="header"></div>
</div>
#drop
has position:absolute
and z-index:100
#header
has position:fixed; top:60px;
As I start scrolling down Chrome ignores the position:fixed
rule. If I remove either of the two styles above from #drop
then Chrome starts respecting the position:fixed
rule.
can't get it working on Ubuntu Chrome 23.0.1271.97 and see the same behavior on Mac Chrome 25.0.1364.99. My friend uses Ubuntu Chrome 25.0.1364.68 beta and it works correctly for him. I've tested it on firefox and it kinda works (with other symptoms)
Has anyone heard of this error? or can anyone even reproduce it?
I'm using openlayers map as another div with position:fixed
if I delete that layer or at least change it to display:none
then this weird bug goes away.
Noticed that during the presence of this bug, if I change the zoom level back and forth, then the position adjusts itself to the proper behavior. To me, this indicates a webkit issue that fails to execute some internal callback function on scroll.
Another extremely strange thing is that I have a few links inside of #header
and they work if I just click the expected location, even though the the div does not appear there. Overall I've noticed that it's only the rendering that's broken. If at any point of time I force the browser to re-render by resizing the window, or changing zoom, or just doing Select-All, then the header bar jumps to the proper position, but does not remain fixed.
You mentioned in the comments that OpenLayers uses CSS transforms. That being the case:
the element with fixed positioning will become relative to the element with the transform - not relative to the viewport
Take a look at the spec: The Transform Rendering Model
Specifying a value other than ‘none’ for the ‘transform’ property establishes a new local coordinate system at the element that it is applied to.
.wpr { width: 200px; height:1000px; background: pink; position:relative; margin: 0 200px; -webkit-transform: translateX(0); transform: translateX(0); } .fixed { width: 200px; height:200px; margin: 50px; position: fixed; top:0; left:0; background: aqua; }
<div class="wpr"> <div class="fixed"></div> </div>