51可用代码模板网站

咨询热线:

181-1164-6936
  • 1
JS代码
当前位置:首页>实用代码>JS代码>

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

时间:2017-08-16 17:17点击:
<!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="/soft/3183.shtml" target="_blank">上面的内容</a></li><li><a href="/soft/3279.shtml" target="_blank">上面的内容</a>

</li><li><a href="/soft/2967.shtml" target="_blank">上面的内容</a></li><li><a href="/soft/5047.shtml" target="_blank">上面的内容</a></li>

<li><a href="/soft/1789.shtml" target="_blank">上面的内容</a></li><li><a href="/soft/1786.shtml" target="_blank">上面的内容</a></li><li>

<a href="/soft/3580.shtml" target="_blank">上面的内容</a></li><li><a href="/soft/3450.shtml" target="_blank">上面的内容</a></li><li>

<a href="/soft/3454.shtml" target="_blank">上面的内容</a></li><li><a href="/soft/2434.shtml" target="_blank">上面的内容</a></li>
        </ul>
    </div>
    <div id="bottom">
        <ul>
            <li><a href="/soft/16003.shtml" target="_blank">下面的内容</a></li><li><a href="/soft/16002.shtml" target="_blank">下面的内容</a>

</li><li><a href="/soft/16001.shtml" target="_blank">下面显示的内容</a></li><li><a href="/soft/16000.shtml" target="_blank">下面显示的内容</a>

</li><li><a href="/soft/15999.shtml" target="_blank">下面的内容</a></li><li><a href="/soft/15921.shtml" target="_blank">下面的内容</a></li><li>

<a href="/soft/15867.shtml" target="_blank">下面的内容</a></li><li><a href="/soft/15866.shtml" target="_blank">下面的内容</a></li><li>

<a href="/soft/15781.shtml" target="_blank">下面的内容</a></li><li><a href="/soft/15780.shtml" target="_blank">下面的内容</a></li>
        </ul>
    </div>
    <div id="line"></div>
</div>
<div><A href="http://www.51kydm.com/">http://www.51kydm.com/</A></div>
</body>
</html> 
51可用模板(代码)网站专为广大站长朋友提供精品模板与代码,同时免费提供网站收录。
本站域名: WWW.51KYDM.COM    联系方式:QQ:182468923    手机:18111646936
本站关键词:网站链接收录网址收录入口网站免费提交收录网站收录提交入口    网站地图
51可用模板
展开