开发者

title of the post always fixed when scrolling page [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜