aarnott
03-16-2007, 03:46 PM
Hi,
I've been working on getting a region of my page to have no scrolling. This means that the section of the page (in this case the header) will remain at the top of the page as I scroll through the rest of the content. My current method is to have 2 div tags, one of which is a "scrollable" area, the other is a non scrollable area. My css file is as follows:
BODY
{
font-size: 80%;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: black;
margin: 0pt;
overflow:hidden;
}
#nsr {
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 5px;
overflow: hidden;
width:100%;
border-bottom: #DBA428 1pt solid;
}
#sr {
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 5px;
overflow-y: scroll;
overflow-x: auto;
width:100%;
height: 100%
}
Then the HTML code is structured like this:
<html>
<head>
<!-- content here -->
</head>
<SCRIPT language="JavaScript" SRC="script.js" TYPE="text/javascript"></SCRIPT>
<body onResize="setNSR();" onLoad="setNSR();">
<div id="nsr">
<!--header here-->
</div>
<div id="sr">
</div>
</body>
</html>
And finally the script it calls:
function setNSR() {
var oBody = document.body;
sr.style.height = oBody.clientHeight - nsr.clientHeight - 1;
nsr.style.height = 0;
}
What is happening right now is the body renders a scrollbar and the scroll-region renders a scrollbar that is inactive. The body allows scrolling, but the non-scroll area gets scrolled (defeating the purpose). Any ideas?
Thanks,
Andrew Arnott
I've been working on getting a region of my page to have no scrolling. This means that the section of the page (in this case the header) will remain at the top of the page as I scroll through the rest of the content. My current method is to have 2 div tags, one of which is a "scrollable" area, the other is a non scrollable area. My css file is as follows:
BODY
{
font-size: 80%;
font-family: Verdana, Arial, Helvetica, sans-serif;
color: black;
margin: 0pt;
overflow:hidden;
}
#nsr {
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 5px;
overflow: hidden;
width:100%;
border-bottom: #DBA428 1pt solid;
}
#sr {
padding-right: 5px;
padding-left: 5px;
padding-bottom: 5px;
padding-top: 5px;
overflow-y: scroll;
overflow-x: auto;
width:100%;
height: 100%
}
Then the HTML code is structured like this:
<html>
<head>
<!-- content here -->
</head>
<SCRIPT language="JavaScript" SRC="script.js" TYPE="text/javascript"></SCRIPT>
<body onResize="setNSR();" onLoad="setNSR();">
<div id="nsr">
<!--header here-->
</div>
<div id="sr">
</div>
</body>
</html>
And finally the script it calls:
function setNSR() {
var oBody = document.body;
sr.style.height = oBody.clientHeight - nsr.clientHeight - 1;
nsr.style.height = 0;
}
What is happening right now is the body renders a scrollbar and the scroll-region renders a scrollbar that is inactive. The body allows scrolling, but the non-scroll area gets scrolled (defeating the purpose). Any ideas?
Thanks,
Andrew Arnott