开发者

Problem resizing div in Chrome

EDIT: What happens can be seen in this page when the height resolution is lower than the entire page (eg.: 1024x768): http://www.depositosalto.com.br/pagamentos.php

I trying to开发者_JS百科 resize a div with the content of page with javascript to always the page fit in the whole screen when it is smaller.

I'm using the following javascript and it works in other navigators(Firefox, Opera). In Chrome it resizes the div too, but unlike the others, it don't pushs the footer div which is just below the content div.

Is there any way around it in chrome?

function defineContentHeight(height){       
  var screenHeight = window.innerHeight;                
  if (screenHeight > (height + 220)){
    height = screenHeight - 220;                
    document.getElementById("content").style.height = height + "px";        
  }
  else{                     
    document.getElementById("content").style.height = height + "px";        
  }
}


The content inside the "conteudo" div is floating, so the height isn't calculated; you can do one of two things:

Add the "overflow:auto" style to the "conteudo" div, which is generally safe, or

Add a div with a style of "clear:both" to the very bottom of the "conteudo" div

For what it's worth, I'm not seeing your bug in Chrome 11, but my guess is that one of those might fix it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜