window.onload = onLoadHandler;
window.onresize = resizeSwfDiv;
var isFull = false;
function onLoadHandler()
{
resizeSwfDiv();
}
function isFullSetting( _isFull )
{
isFull = Boolean(_isFull);
}
function resizeSwfDiv()
{
var _div = document.getElementById("flashWrap");
if(navigator.userAgent.indexOf('MSIE')!=-1){
var _bh = document.body.clientHeight;
if(_bh < 768){
_bh = 0;
_div.style.margin = _bh+' auto 0px auto';
}
else{
_bh = (_bh - 768)/2 + "px";
_div.style.margin = _bh+' auto 0px auto';
}
}
else{
var _bh = innerHeight;
if(_bh < 768){
_bh = 0;
_div.style.margin = _bh+' auto 0px auto';
}
else{
_bh = (_bh - 768)/2 + "px";
_div.style.margin = _bh+' auto 0px auto';
}
}
}
</script>
브라우저를 줄이거나 늘려도 항상 가운데 있게 된다...
세로정렬
가로는 css를 이용해서
margin:0px auto;를 사용하면된다.
'프론트앤드 개발' 카테고리의 다른 글
jquery로 만든 좌, 우 등장후 다른화면으로 바뀌는 것 (0) | 2012.11.08 |
---|---|
구글 오늘의 두들!! (0) | 2012.04.09 |
메타 태그관련 (0) | 2011.03.28 |
IE9 CSS적용 범위 (0) | 2011.03.21 |
비IE 스크랩하기 javascript (0) | 2011.03.07 |