星空网 > 软件开发 > Java

类似QQ对话框上下部分可拖动代码

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>类似QQ对话框上下部分可拖动代码-例子代码</title>
<style>
ul,li{margin:0;padding:0;}
body{font:14px/1.5 Arial;color:#666;}
#box{position:relative;width:600px;height:400px;border:2px solid #000;margin:10px auto;overflow:hidden;}
#box ul{list-style-position:inside;margin:10px;}
#box div{position:absolute;width:100%;}
#top,#bottom{color:#FFF;height:100%;overflow:hidden;}
#top{background:green;}
#bottom{background:skyblue;top:50%}
#line{top:50%;height:4px;overflow:hidden;margin-top:-2px;background:red;cursor:n-resize;}
</style>
<script>
function $(id) {
return document.getElementById(id)

}
window.onload = function() {
var oBox = $("box"), oBottom = $("bottom"), oLine = $("line");
oLine.onmousedown = function(e) {
var disY = (e || event).clientY;
oLine.top = oLine.offsetTop;
document.onmousemove = function(e) {
var iT = oLine.top + ((e || event).clientY - disY);
var maxT = oBox.clientHeight - oLine.offsetHeight;
oLine.style.margin = 0;
iT < 0 && (iT = 0);
iT > maxT && (iT = maxT);
oLine.style.top = oBottom.style.top = iT + "px";
return false
};
document.onmouseup = function() {
document.onmousemove = null;
document.onmouseup = null;

oLine.releaseCapture && oLine.releaseCapture()
};
oLine.setCapture && oLine.setCapture();
return false
};
};
</script>
</head>
<body>
<center>上下拖动红条改变显示区域高度</center>
<div id="box">
<div id="top">
<ul>
<li><a href="http://www.cnblogs.com//soft/3183.shtml" target="_blank">上面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/3279.shtml" target="_blank">上面显示的内容</a></li><li><a


href="http://www.cnblogs.com//soft/2967.shtml" target="_blank">上面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/5047.shtml" target="_blank">上面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/1789.shtml"


target="_blank">上面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/1786.shtml" target="_blank">上面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/3580.shtml" target="_blank">上面显示的内容


</a></li><li><a href="http://www.cnblogs.com//soft/3450.shtml" target="_blank">上面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/3454.shtml" target="_blank">上面显示的内容</a></li><li><a


href="http://www.cnblogs.com//soft/2434.shtml" target="_blank">上面显示的内容</a></li>
</ul>
</div>
<div id="bottom">
<ul>
<li><a href="http://www.cnblogs.com//soft/16003.shtml" target="_blank">下面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/16002.shtml" target="_blank">下面显示的内容</a></li><li><a


href="http://www.cnblogs.com//soft/16001.shtml" target="_blank">下面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/16000.shtml" target="_blank">下面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/15999.shtml"


target="_blank">下面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/15921.shtml" target="_blank">下面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/15867.shtml" target="_blank">下面显示的内


容</a></li><li><a href="http://www.cnblogs.com//soft/15866.shtml" target="_blank">下面显示的内容</a></li><li><a href="http://www.cnblogs.com//soft/15781.shtml" target="_blank">下面显示的内容</a></li><li><a


href="http://www.cnblogs.com//soft/15780.shtml" target="_blank">下面显示的内容</a></li>
</ul>
</div>
<div id="line"></div>
</div>
<div>http://www.999jiujiu.com/</div>
</body>
</html>




原标题:类似QQ对话框上下部分可拖动代码

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流