I'm developing a wordpress theme, with an isotope grid and where a hover on a post should display its title with a fixed position on the bottom of the browser. I have this simplified structure:
<div id="main">
<article class="hubbub">
//article content
<h2 class="subtitled">
//h2 content
</h2>
</article>
</div>
Via jQuery, a hover on <article>
should display its child element h2.subtitled
. <article>
is positioned relative, but gets an absolute position by the isotope script. The h2.subtitled
is positioned fixed with:
.subtitled {
display: none;
position: fixed;
z-index: 999999999;
bottom: 20px;
left: 0;
width: 100%;
font-family: Arial, Helvetica, sans-serif;
font-size: 42px;
text-align: center;
color: yellow;
}
For some reason, the h2.subtitle
elements get positioned fixed related to the parent <article>
element, so an the bottom of each <article>
. If I set the <h2>
outside of the <article>
, it is positioned fixed related to the browser, but they need to be inside of the <article>
element, because an infinite scroll appends the new <article>
elements and they should as well contain the <h2>
titles.
Does anyone know, how to make this position fixed and related to the browser window?
Thanks!
fixed
always atach the element in relation to the viewport so you maybe have another script or css overriding the fixed position – Khufu