Welcome to Dream.In.Code
Getting Help is Easy!

Join 132,273 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,158 people online right now. Registration is fast and FREE... Join Now!




Need help with dynamic div resizing.

 
Reply to this topicStart new topic

Need help with dynamic div resizing., Problem with IE (go figure)

Daftajest
post 2 Oct, 2008 - 07:36 PM
Post #1


New D.I.C Head

*
Joined: 2 Oct, 2008
Posts: 2


My Contributions


So I'm trying to get my site to dynamically shift with the size of the browser when it loads up...It works fine in Firefox 3, Opera and (as far as I know), FF2.

IE is the only browser that I see that has any problem with it whatsoever, which never ceases to surprise me, as IE tends to eat all forms of code, regurgitate them, and devour the slimy and putrid remains, just to continue the process.

Anyways...I'm not really a whiz at JavaScript (just started using it a week ago), and I have no idea how to fix it just for IE...Here it is.

Initial Script
<script type='text/javascript'>
function getPageHeight(){
if(window.innerHeight){
_output=window.innerHeight;
}else{
_output=document.documentElement.clientHeight;
}
return _output;
}
function getPageWidth(){
if(window.innerWidth){
_output=window.innerWidth;
}else{
_output=document.documentElement.clientWidth;
}
return _output;
}
</script>


Resize call
<script type='text/javascript'>
document.getElementById('leftcol').style.height=getPageHeight()-125-48+'px';
document.getElementById('maincol').style.height=getPageHeight()-126-48+'px';
document.getElementById('maincol').style.width=getPageWidth()-152+'px';
document.getElementById('speakmain').style.height=getPageHeight()-148-32+'px';
</script>
User is offlineProfile CardPM

Go to the top of the page

Martyr2
post 2 Oct, 2008 - 09:12 PM
Post #2


Programming Theoretician

Group Icon
Joined: 18 Apr, 2007
Posts: 5,025



Thanked 173 times

Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions


Do you have an actual URL that you can show us with? Then please describe what you see in FF versus IE. Screenshots would be helpful too.

smile.gif
User is online!Profile CardPM

Go to the top of the page

Daftajest
post 3 Oct, 2008 - 02:11 PM
Post #3


New D.I.C Head

*
Joined: 2 Oct, 2008
Posts: 2


My Contributions


http://daftajest.com/new

I would post some screenshots, but I'm sure you guys can tell by the urls alone...

EDIT: And the differences are...In IE it just resorts to showing it all and stretching the page, but in FF, it locks in place, and doesn't stretch the page. I know it's not my CSS settings, because it does it when I set it to scroll as well.

This post has been edited by Daftajest: 3 Oct, 2008 - 03:46 PM
User is offlineProfile CardPM

Go to the top of the page

tkulev
post 3 Oct, 2008 - 11:33 PM
Post #4


New D.I.C Head

*
Joined: 3 Oct, 2008
Posts: 13


My Contributions


Well, the problem is that IE understand a things different from other browsers smile.gif

To get a resolution in all browsers, use :
JavaScript


if( typeof( window.innerWidth ) == 'number' ) {
w = document.documentElement.clientWidth;
h = window.innerHeight;

}
else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
w = document.documentElement.clientWidth;
h = document.documentElement.clientHeight;
}
else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
w = document.body.clientWidth;
h = document.body.clientHeight;
}



But why you use JS to resize this simple block ? You can do this only with css smile.gif

This post has been edited by tkulev: 3 Oct, 2008 - 11:34 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 12:27AM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month