JQuery window resize issue?

At first glance, the reason its not reacting to resize event properly is because dimensions() and center() functions use variables initialized only once, while they should be computed at the time resize event occures. Otherwise you try to react to resize event but you're using the same values over and over again, e.g. No matter what size browser is the availableHeight variable has the same value it had when you ran respond function for the first time.

That sounds like gold. I'm not sure where to put the variables so that they're recalculated appropriately. If I put them in the dimensions function ËšcenterËš won't get them – technopeasant Sep 5 at 10:15 Hmm, just make another function that will recalculate the variables values and then call that function at the beginning of the dimensions and center functions.

– WTK Sep 5 at 10:21.

The window.resize() event is quite buggy across different browsers. Try using the jQuery resize event by Ben Alman, usually fixes all resize issues.

Looking at your code it seems like you could achieve the same result using pure CSS. If my thinking is correct, you want to resize the image along with the window and also keep the image in the middle of the page. By setting a % width on the image you can cause it to resize in accordance with its parent element.

#main{ width:50%; } img{ width:100%; } and by setting margin:0 auto; on #main you'll always keep things centered on the page. Here's a demo: jsfiddle.net/BjVun.

Doesn't work if you size the browser below the image height. When I get this resize thing settled you'll see what I'm going for. – technopeasant Sep 5 at 10:02.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions