Guest Caderial Posted March 21, 2010 Report Share Posted March 21, 2010 I am attempting to use javascrip to resize a div for lower resolution users , my issue is if I shrink the window it effectivly changes the size of the div to 1000px as expected but if i bring the browser window back out to my full size it stays at the 1000px. Ideally i would like the div to scale down to 1000px instead of just jumping to 1000 px and when you widen your window again it would scale back up to 1300px;. any suggestions? <script language="javascript"> function fittheDivs(){ if(document.body.clientWidth<1024){ document.getElementById('bodyimgwrapper').style.width="1300px"; }else{ //alert(document.getElementById('bodyimgwrapper').style.width); document.getElementById('bodyimgwrapper').style.width="1000px"; } } </script> </head> <body onresize="fittheDivs();"> Quote Link to comment Share on other sites More sharing options...
administrator Posted March 22, 2010 Report Share Posted March 22, 2010 I would suggest using jquery as it has a bunch of UI widgets and functionality that will make doing this stuff much easier. Stefan Quote Link to comment Share on other sites More sharing options...
falkencreative Posted March 22, 2010 Report Share Posted March 22, 2010 One option, depending on the exact features you need, might be to give your div a percentage width, rather than a fixed pixel width. You could then use min-width and max-width to control the minimum and maximum size of your div. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.