Div doesn't resize until page refresh - CSS

Hi. I am using a javascript text scroller which in turn scrolls text within a DIV element. The DIV is specified using CSS:

#pscroller1
{
width: 95%;
height: 15%;
padding: 5px;
overflow: visible;
border: 0px solid #000000;
}

My problem is that when the window is made smaller/bigger, the div doesn't change its' size until the page is refreshed. Anyone know how to do this automatically?
LVL 2
chris_smith_51Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eternal_StudentCommented:
You mean the browser window right?

If you have set the width as a percentage then it should re-size automatically. Do you have something I could look at to see this problem in more detail?
0
NerdsOfTechTechnology ScientistCommented:
replace <html> with:

newer browsers should allow for auto width based on %
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">

Open in new window

0
chris_smith_51Author Commented:
@Eternal_Student:

Yes, I mean the browser window.

See www.csgshow.org for what I'm talking about. The scroller is in the upper-left corner of the page beneath the main links.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

NerdsOfTechTechnology ScientistCommented:
use fixed height
#pscroller1
{
width: 95%;
height: 200px;
padding: 5px;
overflow: visible;
border: 0px solid #000000;
}

Open in new window

0
chris_smith_51Author Commented:
unfortunately the problem still exists....
0
NerdsOfTechTechnology ScientistCommented:
If it is the scrolling link area... then your ID# is wrapper or wrapper2 NOT #pscroller :)

Style.css

I added #wrapper

#wrapper
{
width: 95%;
height: 200px;
padding: 5px;
overflow: visible;
border: 0px solid #000000;
}


you could also revert to %

#wrapper
{
width: 95%;
height: 15%;
padding: 5px;
overflow: visible;
border: 0px solid #000000;
}
html, body, ul, li, h1, h2, h3, h4 {
	margin: 0;
	padding: 0;
	list-style: none;
}
img {
	border: 0;
}
a {
	color: #333;
	font-weight: bold;
	text-decoration: none;
}
a:hover {
	color: #f00;
}
 
.expansionSelected {
	color: #f00;
	font-weight: bold;
	text-decoration: none;
}
 
.expansionNotSelected {
	color: #333;
	font-weight: bold;
	text-decoration: none;
}
 
.left {
	float: left;
}
.right {
	float: right;
}
body 
{
	background: url('../Images/Construction/header_bg.jpg') repeat-x top left;
	text-align: center;
	font: 12px arial, sans-serif;
}
#wrapper {
	text-align: left;
	margin: auto;
	width: 100%;
}
#wrapper2 {
	text-align: left;
	margin: auto;
	width: 95%;
}
#logo {
	background: url('../Images/Construction/logo.gif') no-repeat top left;
	height: 78px
}
#logo h1 {
	color: #FD2E00;
	font-weight: normal;
	font-size: 28px;
	padding: 20px 0 0 90px;
	margin: 0;
}
#logo p {
	color: #333333;
	padding: 0 0 0px 90px;
	margin: 0;
	font-size: 16px;
}
#sectionLinks {
	background: url('../Images/Construction/header_c_bg.gif') repeat-x;
	position: relative;
	height: 370px
}
#sectionLinks a {
	color: #E7E4E4;
	text-decoration: none;
}
#sectionLinks a:hover {
	color: #fff;
	text-decoration: none;
}
#sectionLinks ul {
	padding: 70px 0 0 382px;
	margin: 0;
	position: relative;
	z-index: 1;
}
#sectionLinks li {
	background: url('../Images/Construction/bullet.gif') no-repeat left center;
	margin: 0; padding-left:30px; padding-right:0; padding-top:10px; padding-bottom:8px
}
#sectionLinks li#m1 { margin-left: 19px; }
#sectionLinks li#m2 { margin-left: 9px; }
#sectionLinks li#m3 { margin-left: 3px; }
#sectionLinks li#m4 { margin-left: 0px;  }
#sectionLinks li#m5 { margin-left: 2px; }
#sectionLinks li#m6 { margin-left: 8px; }
#sectionLinks a { font-weight: normal; }
#search {
	margin: 15px 0 0 400px;
}
#search h3 {
	color: #000000;
	font-weight: normal;	
}
#search a {
	color: #1c4c96;
	font-weight: bold;
	text-decoration: none;
}
#search a:hover {
	color: #f00;
}
#mainImage {
	background: url('../Images/Construction/header.jpg') no-repeat;
	position: absolute;
	top: 0;
	left: 0;
	width: 382px;
	height: 370px
}
#mainImageCorner {
	background: url('../Images/Construction/header_pip.jpg') no-repeat;
	position: absolute;
	top: 0;
	left: 382px;
	width: 48px;
	height: 94px			
}
#body {
	width: 100%;
}
#body-inner {
	padding: 23px 23px 8px 23px;
}
#body hr {
	color: #999999;
	height: 1px;
}
#body h2 {
	color: #FF0000;
}
#body h3 {
	color: #1c4c96;
}
#body-left {
	float: left;
	width: 30%;
}
#body-center {
	float: left;
	width: 30%;
}
#body-right {
	float: right;
	width: 34%;
}
#body-nav {
	float: left;
	width: 20%;
}
#body-main {
	float: right;
	width: 77%;
}
#body-main a {
	color: #1c4c96;
	font-weight: bold;
	text-decoration: none;
}
#body-main a:hover {
	color: #f00;
}
#body-left ul {
	margin: 30px 55px;
}
#body-left li {
	margin: 5px;
}
#separator {
	float: left;
	width: 3%;
	display: block;
}
#body-right .box {
	padding: 15px;
	background: #fff;
	border: 1px solid #999;
	margin: 2em 0;
}
#body-right .box p {
	margin: 0 0 1em 0;
}
#body-right .box .left {
	margin-right: 10px;
	border: 0px solid #999;
}
#body-right .box .button {
	text-align: right;
	padding-top: 0px;
	position: relative;
}
.button a {
	border-left:2px solid #9C2828; border-right:2px solid #650000; border-top:2px solid #E68282; border-bottom:2px solid #650000; background:#CC0000 url('../Images/Construction/btn.gif') repeat-y left; color: #fff;
	font-weight: normal;
	position: relative; padding-left:20px; padding-right:15px; padding-top:3px; padding-bottom:3px
}
.button a:hover {
	background-color: #EF1818;
	color: #fff;
}
#copyright-bar {
	background: url('../Images/Construction/footer_bg.gif') repeat-x;
	width: 100%;
	margin-top: 10px;
	clear: both;
}
#copyright-text {
	margin-top: 20px;
	padding-bottom: 10px;
	width: 33%;
	margin-bottom: 10px;
	font-size: 11px;
	float: left;
	display: inline;
	text-align: center;
}
#copyright-text1 {
	margin-top: 20px;
	padding-bottom: 10px;
	width: 33%;
	margin-bottom: 10px;
	font-size: 11px;
	float: left;
	display: inline;
	text-align: center;
}
#copyright-text2 {
	margin-top: 20px;
	padding-bottom: 10px;
	width: 33%;
	display: inline;
	float: left;
	margin-bottom: 10px;
	font-size: 11px;
	text-align: center;
}
#navigation {
	margin-top: 7px;
	width: 100%;	
	font-size:90%;
}
#navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
}
#navigation li a  {
	display: block;
	padding: 5px 5px 5px 0.5em;
	border-left: 7px solid #809fff;
	border-right: 1px solid #809fff;
	border-bottom: 1px solid #809fff;
	background-color: #bfcfff;
	color: #00248f;
	text-decoration: none;
}
#navigation li a:hover {
	background-color: #809fff;
	color: #00248f;
}
#navigation ul ul {
	margin-left: 12px;
}
#navigation ul ul li {
	margin:0;
	background-color: #bfcfff;
	color: #00248f;
}
#navigation ul ul a:link, #navigation ul ul a:visited {
	background-color: #bfcfff;
	color: #002485;
}
#navigation ul ul a:hover {
	background-color: #809fff;
	color: #00248f;
}
.breadcrumb {
	font-weight:bold;
}
#pscroller1
{
width: 95%;
height: 15%;
padding: 5px;
overflow: visible;
border: 0px solid #000000;
}
 
#wrapper
{
width: 95%;
height: 200px;
padding: 5px;
overflow: visible;
border: 0px solid #000000;
}
 
.someclass{
}

Open in new window

0
David S.Commented:
It seems to me that the problem is the scroller script itself. This line sets the width of the elements to a fixed width when the script initializes.

this.visiblediv.style.width=this.hiddendiv.style.width=this.tickerdiv.offsetWidth-(this.visibledivtop*2)+"px"

Try adding the following code block after this line:

new pausescroller(pausecontent, "pscroller1", "someclass", 5800)
window.onresize = function(){
  var tickerid = "pscroller1";
 
  tickerdiv=document.getElementById(tickerid);
 
  visiblediv=document.getElementById(tickerid+"1");
 
  hiddendiv=document.getElementById(tickerid+"2");
 
  visibledivtop=parseInt(pausescroller.getCSSpadding(tickerdiv));
 
  //set width of inner DIVs to outer DIV's width minus padding (padding assumed to be top padding x 2)
 
  visiblediv.style.width=hiddendiv.style.width=tickerdiv.offsetWidth-(visibledivtop*2)+"px";
}

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
chris_smith_51Author Commented:
excellent! thanks :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
CSS

From novice to tech pro — start learning today.