最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How do you create a html scrollable area, that just uses the main browser scrollbar - Stack Overflow

programmeradmin0浏览0评论

I was looking at an issue in JIRA (e.g. here, an issue in JIRA 4) and I noticed JIRA 4 has some interesting scrolling behaviour, where when scrolling down with the main browser scrollbar,the jira header scrolls up out of way, then the issue title stays fixed at top, then the rest of the issue continues to scroll. So the issue title is always visible.

There isn't an extra vertical scrollbar. Its all scrolled via the main browser scrollbar. So its either css or javascript magic! Any idea how they do that?

Cheers,

Phil.

I was looking at an issue in JIRA (e.g. here, an issue in JIRA 4) and I noticed JIRA 4 has some interesting scrolling behaviour, where when scrolling down with the main browser scrollbar,the jira header scrolls up out of way, then the issue title stays fixed at top, then the rest of the issue continues to scroll. So the issue title is always visible.

There isn't an extra vertical scrollbar. Its all scrolled via the main browser scrollbar. So its either css or javascript magic! Any idea how they do that?

Cheers,

Phil.

Share Improve this question edited Feb 9, 2011 at 11:03 Phil asked Feb 7, 2011 at 14:05 PhilPhil 3751 gold badge2 silver badges14 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 5

It changes dynamically the div #stalker which has position:absolute;top:76px;. When the user scroll, change the position to position:fixed;top:0 and keep it in a fixed place, giving you the ability to scroll the rest content.


Edit

I created an example of this behavoir, because I was curious and here the demo if you want to check it http://jsbin./igiji5/3

Atlassian published the source of the Javascript at http://docs.atlassian./aui/3.0/jquery.stalker.js.html

That is created using JavaScript.

I can see by using FireBug to inspect the div#stalker that it changes class and style attributes when you are scrolling.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论