div页面底部对齐[提取修改]
2009-02-10 14:05
585 查看
<script language="javascript" type="text/javascript">
function $()
{
return document.getElementById?document.getElementById(arguments[0]):eval(arguments[0]);
}
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)
Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
else if (window.opera)
Sys.opera = ua.match(/opera.([\d.]+)/)[1]
else if (window.openDatabase)
Sys.safari = ua.match(/version\/([\d.]+)/)[1];
function getClientBounds()
{
var clientWidth;
var clientHeight;
if (Sys.ie)
{
clientWidth = document.body.clientWidth;
clientHeight = document.body.clientHeight;
}
else if (Sys.safari)
{
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
}
else if (Sys.opera )
{
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
}
else
{
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
}
return { width : clientWidth, height : clientHeight };
}
function resetLiveMessengerPosition()
{
var clientBounds = getClientBounds();
var container = document.getElementById("liveMessengerContainer");
var scrollLeft = (document.documentElement.scrollLeft ?
document.documentElement.scrollLeft : document.body.scrollLeft);
var scrollTop = (document.documentElement.scrollTop ?
document.documentElement.scrollTop : document.body.scrollTop);
var containerLeft = scrollLeft + clientBounds.width - container.clientWidth - 5;
var containerTop = scrollTop + clientBounds.height - container.clientHeight;
$("liveMessengerContainer").style.top=containerTop + "px";
$("liveMessengerContainer").style.left=containerLeft + "px";
}
window.onscroll=function(){resetLiveMessengerPosition();};
window.onresize=function(){ resetLiveMessengerPosition();};
window.onload=function(){ resetLiveMessengerPosition();};
</script>
function $()
{
return document.getElementById?document.getElementById(arguments[0]):eval(arguments[0]);
}
var Sys = {};
var ua = navigator.userAgent.toLowerCase();
if (window.ActiveXObject)
Sys.ie = ua.match(/msie ([\d.]+)/)[1]
else if (document.getBoxObjectFor)
Sys.firefox = ua.match(/firefox\/([\d.]+)/)[1]
else if (window.MessageEvent && !document.getBoxObjectFor)
Sys.chrome = ua.match(/chrome\/([\d.]+)/)[1]
else if (window.opera)
Sys.opera = ua.match(/opera.([\d.]+)/)[1]
else if (window.openDatabase)
Sys.safari = ua.match(/version\/([\d.]+)/)[1];
function getClientBounds()
{
var clientWidth;
var clientHeight;
if (Sys.ie)
{
clientWidth = document.body.clientWidth;
clientHeight = document.body.clientHeight;
}
else if (Sys.safari)
{
clientWidth = window.innerWidth;
clientHeight = window.innerHeight;
}
else if (Sys.opera )
{
clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
}
else
{
clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
}
return { width : clientWidth, height : clientHeight };
}
function resetLiveMessengerPosition()
{
var clientBounds = getClientBounds();
var container = document.getElementById("liveMessengerContainer");
var scrollLeft = (document.documentElement.scrollLeft ?
document.documentElement.scrollLeft : document.body.scrollLeft);
var scrollTop = (document.documentElement.scrollTop ?
document.documentElement.scrollTop : document.body.scrollTop);
var containerLeft = scrollLeft + clientBounds.width - container.clientWidth - 5;
var containerTop = scrollTop + clientBounds.height - container.clientHeight;
$("liveMessengerContainer").style.top=containerTop + "px";
$("liveMessengerContainer").style.left=containerLeft + "px";
}
window.onscroll=function(){resetLiveMessengerPosition();};
window.onresize=function(){ resetLiveMessengerPosition();};
window.onload=function(){ resetLiveMessengerPosition();};
</script>
相关文章推荐
- css中怎么让div里面的文字底部对齐
- 阻止在div上滚动滚动条,到底部和顶部带动整个页面的滚动条
- DIV相对于父DIV底部对齐的实现方法
- div一直浮动在页面的底部
- 页面前台-用DIV+CSS让footer始终在底部
- 通过查询数据库中的数据匹配在页面上:(set单条数据属性是在页面上的显示与foreach的不同) 通过ID修改提取位置表信息
- 通过使用绝对定位和相对定位,实现div底部对齐
- DIV+CSS:页脚永远保持在页面底部
- css使DIV位于页面最底部
- 用js 让图片在 div或dl里 居中,底部对齐
- CSS如何把DIV永远置于页面的底部
- 如何让图片在垂直方向与 div的底部对齐 水平居中
- CSS布局之div交叉排布与底部对齐--flex实现
- [转]div内容底部对齐
- h5页面,输入法顶起页面底部div.(安卓有此问题,ios没问题)
- 关于div中图片无法底部对齐的问题
- CSS控制DIV永远固定在页面底部
- 【转】DIV+CSS页面让footer始终在底部
- DIV总显示在页面底部css
- js的页面初始化,修改div的值,查询多选框的val