Onresize Problems With Ie?

Feb 26, 2004

I have a left column that needs to be resized based on the middle content height. (the left nav needs to be subtracted from the total maxHeight to determine how long to make the left column) I am using the following:

function adjustLayout()
{
var main_height = document.getElementById("main").offsetHeight;
var left_nav_height = document.getElementById("vertical_left_nav").offsetHeight;
var maxHeight = Math.max(main_height, left_nav_height);
var left_content_height = maxHeight - left_nav_height;
document.getElementById("left_content").style.height = left_content_height+'px'
}
window.onresize = function()
{
adjustLayout();
}
PROBLEM: The code works in firebird (even with multiple resizing), but in IE 6 the the left nav will not shorten if resized. In fact, it appears that each time you resize, the left column gets longer, and longer - so it is stretching the page way beyond the content.

Does this make sense?

View 8 Replies


ADVERTISEMENT

Onresize

Oct 12, 2005

I'm having a problem getting the window.onresize to work properly. Here
is a simple test case I wrote:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test window.onresize</title>
<script type="text/javascript">
function resize_func() {
alert ('resize_func has been called');
}
window.
</script>
</head>
<body>
<p>Just Some Text</p>
</body>

When I load this page in firefox (1.0.6). I get the alert box that pops
up on initial load, but any subsequent resizing of the window fails to
trigger the event. It's probably something really simple, but so far
I'm stumped.

View 1 Replies View Related

Multiple Onresize In IE

Dec 6, 2005

I have a script that is called by the window.onresize event. The
problem is that the script is called multiple times when I'm resizing
the window in IE - obviously, because IE continuously fires the
onresize event while it is being resized.

What I'm wondering is - does anyone have any suggestions on making the
script function only once, after the last onresize event, rather than
on every one?

I've done some searching, but I'm not getting much - probably because
I'm having trouble finding a good phrasing for the search.

View 2 Replies View Related

Getting Window Dimension With Onresize

Apr 10, 2009

I want to make a nice floating bar at the bottom of the screen, which hovers about 15px from the bottom. I am doing this to make a site look good in small and big resolutions. The minimum height for the bar to hover is 600px about, if the window is smaller, it is still there so it doesn't go into the content, if the window is bigger, it will follow the resize and be at the bottom still. It is obviously absolutely positioned, and also centered using some javascript (getting the width of the window).The second function is called in the header and positions the bar. The last two document.get things are just for testing so I can see the height in px somewhere. This works fine in IE. If I resize the window, making it shorter, everything goes as planned, and I can see the pixel count dropping in the header where it is displayed. However, in FF it does not work.

The weird thing is this. If I resize by a small amount, less than 10px, it works fine. However, I can not resize by more than 10px! If I do, the window height shown in the top still drops by only 10px.So if my window is 1000px tall, and I close it to say 500px, the value of the height will still be 990px. If I then resize it to any where higher than the 500px, say 550px, the javascript still sees it as making it smaller, since it says the height is 990px, therefore, the window height goes down to 980px. If I shrink the window to 500px and reload everything is fine, if I make it bigger, it works in both browsers. I am thinking that this could be a problem which is like "sampling rate" in music. When in IE I expand or shrink the window I can see the pixel count drop continuously and the bar floating down as I move the window, as if it was "sampled" every 0.05 seconds or something. In FF, shrinking is not working, but if I expand the window the pixel count doesn't change and the bar doesn't change place until I stop resizing (let go of the mouse button), as if it was sampled once, when I stop, so the problem maybe is related?

View 1 Replies View Related

How Do I Set A Div Width Through The Onresize Event?

Jan 3, 2003

I am trying to set a div width through the onresize event. For some reason, I am able to set the height ok. When setting the width, it will set once and then both the height and the width will not respond to the onresize event anymore. I basically want the div to resize whenever the browser is resized.

To demonstrate what I mean, copy and paste this code into a htm file. Add long strings of text to the div so that it will scroll both horizontally and vertically. Notice when resizing, the resize will get called once, but when resizing again it will not. Comment out the width line, and now the resizing will always get called.

Here is the code:

View 2 Replies View Related

Window.onresize Slow (firefox)

Mar 19, 2007

I am attempting to modify the style of an element (its width) as the
window is being resized, in firefox.

Long story short, I've tried to use CSS but one particular part of the
layout just won't do what I need.

The javascript solution assigns a function to window.onresize that
sets the inline style, it works with one problem -- the handler only
gets called after the resizing stops, and so there is noticeable lag
before it redraws.

It is not the function that is taking a long time to execute, its
appears to be firefox's handling. It doesn't call it as frequently as
I expected.

Is there another javascript method to accomplish this without the
extra lag?

View 2 Replies View Related

Validate 'onresize' Function Call

Nov 19, 2004

I've built a page which uses javascript to snap roll-over layers to a centered (div) layer. It works fine, and is called when the page loads. However, calling the same function 'onresize' works, but doesn't validate as XHTML - because the XHTML body tag does not support the onresize event handler.

As a consequence, I need to extract the onresize handler into it's own script file and use it to call a page reload.

I can get this to work in IE 6 on a PC, but it doesn't work in FireFox. I really need this to be as cross-compatible as possible. The code I have in the page header is:


Code:

<script type="text/javascript">
function reDo(){ window.location.reload() }
window.onresize = reDo;
</script>

Does anyone know how to achieve a cross-compatible means of reloading a page upon resizing?

View 1 Replies View Related

Window.onresize, Width & Scrollbars

May 17, 2007

I'm listening for the window.onresize event and trying to get the document.body.clientWidth afterwards to make sure a wide block fits onscreen. I'm working in Firefox and the thing is, when a scrollbar is added to the page due to content getting longer, the body.clientWidth gets smaller, but the window.onresize doesn't fire (I guess this makes sense as the window hasn't been resized per se).

I am assuming that I will have to check the body.clientWidth manually after the content gets longer and then call my resize function if so. But is there a way to achieve this or watch body.clientWidth other than window.onresize?

View 2 Replies View Related

IE - Detect Maximize Vs Regular Onresize?

Apr 25, 2010

in IE, my page gets buggy when the user resizes the window. ive fixed it for when the user clicks and drags the corner of IE, but it is still buggy when the user maximizes the window. i know i can fix this as well if i can just learn to detect the difference on the onresize event between maximizing and all other ways the user can resize it.

View 6 Replies View Related

Window.onresize And Text Size Change

Jan 7, 2005

The window.onresize is not called (in Mozilla) when changing the text size on the browser (crtl + or View/Text Zoom).

Is the xAddEventListener function usefull ? What does the "For some browsers the window.onscroll and window.onresize events are simulated." mean ?(found in the X Library function reference).

View 2 Replies View Related

Use The OnResize() Event To Dynamically Resize A Webpage?

Oct 27, 2008

How does one use the onResize() event to dynamically resize a web page according to the size of the user's viewport?

View 10 Replies View Related

Onresize Pereserve Aspect Ratio Slightly Off In IE?

Mar 31, 2010

so im almost finished my first site! very excited. its for my dads business, hes a screening contractor.actually i doubt he will get any business out of it, even once we get our real domain name and everything because i don't even know how to get Google to like it. its OK though, its mainly just a practice site for me anyways before i make a resume site for myself. anyways, this mayt sound like a flash question but i asked on flash sites and they have no idea, and i think it has more to do with how i embedded the flash. yoy see, it consists of 3 divs, an html content area, and a flash banner and a flash menu, which stretch depending on the window size to keep their aspect ratio. its that streachyness that i believe is causing the problem. everything works exactly as planned in Firefox, chrome, and pure flash player. but in IE, safari and opera, the size and position of things are way messed up! (only really care about IE). the edges of dynamic text are slightly to the left or right and hanging behind things because of it, same with some movie clips and when i didn't want things to appear on the stage i set their x position to be the length of the stage,

i think that ie is calculating the size onresize incorrectly. heres the site, take a look at the the script file:[URL]..

View 1 Replies View Related

Refreshing Page At OnResize Event: Problem With Firefox

Aug 27, 2005

I need to refresh page cathcing "onResize" event.

I wrote this code:

<body onResize="javascript:winodw.location.reload(true); return true;">

On I.E. it works, but it doesn't work on Firefox.

View 6 Replies View Related

Window.onresize Firing When The Page Is Initially Loaded?

Jan 16, 2009

I'm having a problem with window.onresize firing when the page is initially loaded.

View 2 Replies View Related

Window.resizeTo() Inside A Window.onResize Event Handler Function?

Apr 23, 2011

I want to preserve a 16/9 aspect ratio to the window after any resize, making the width a function of the height.

As I have a window.resizeTo() inside the window.onresize event function, the infinite loop is served. How may I quit it?

<html><head><title>Title</title><script languaje="javascript">
const c_ra=16/9;
window.onresize = function WindowReSize() {
var myWidth = 0, myHeight = 0;

[Code].....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved