title of the post always fixed when scrolling page [closed]
I use wordpress.
user: user
pass: 123abc开发者_运维百科
I wish the title of the post always fixed when scrolling page. http://www.correnteparaobem.com.br/onde-se-encontra-a-casa-de-deus
For example:
We opened an article, the title we have in place standard. Once down the page, it keeps it on top of the site. When climbing the screen, he returns to the place of origin.
I tried to guide me through this tutorial: http://pt.w3support.net/index.php?db=so&id=1216114
I changed the title to a div:
< div class="postheader"> < ? php the_title ();> < / div>
I tried the css:
. postheader {
margin: 0.2em 0;
padding: 0;
font-size: 18px;
color: # 3f5e73;
background-color: # ffffff;
color: # 3f5e73;
height: 30px;
position: absolute;
top: 0px;
width: 400px;
z-index: 100;
}
And in the body, this script:
$ (window). scroll (function (e) {
$ el = $ ('. postheader');
if ($ (this). scrollTop ()> 0 & & $ el.css ('position')! = 'fixed') {
$ ('. postheader'). css ({'position': 'fixed', 'top': '0 px '});
}
});
Not getting results
In CSS, use position: fixed;
. Also, check for extra spaces in your code...
精彩评论