开发者

PageDown/Up and Home/End keys don't scroll the page when a position:fixed div is present

开发者 https://www.devze.com 2023-01-20 20:27 出处:网络
I have a page that has a position:fixed div at the top:0px and bottom:0px (making a header and footer). When either the header or footer has \"focus\", I am able to use PageDown, PageUp, Home, End, an

I have a page that has a position:fixed div at the top:0px and bottom:0px (making a header and footer). When either the header or footer has "focus", I am able to use PageDown, PageUp, Home, End, and Spacebar to scroll the page. But if I click within the main "content" div and try to use 开发者_开发知识库those keys, it no longer works.

There aren't any page/body/form-level scripts that are listening for onkeydown/onkeyup.

I'm developing for Internet Explorer 7.

Does anyone know why this happens?


There is something else going on with your page that is preventing those keys from performing. Strip out everything except the header, footer, and content area.

<div style="position:fixed; top:0px; height:100px; background-color:pink;">header</div>
<div style="width:100%; height:900px; background-color:orange;">content</div>
<div style="position:fixed; bottom:0px; height:100px; background-color:skyblue;">footer</div>

Validate that the keys are working how you expect them to. Then start reassembling the page one major section at a time until you run into the issue again.

0

精彩评论

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