关于包含Iframe的页面分栏拖动的问题。

GGGc_ 2012-08-07 10:46:36
不知道怎么的 ,只要页面存在Ifrmae 分栏的拖动就变的很慢。】
第一次的拖动还行,第二次就获取不到鼠标的位置了、
...全文
134 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
GGGc_ 2012-08-07
  • 打赏
  • 举报
回复
 <style type="text/css">
.left_iframe
{
width: 180px;
height: 92%;
background: transparent;
}
.main_iframe
{
z-index: 1;
width: 100%;
height: 650px;
}
</style>
GGGc_ 2012-08-07
  • 打赏
  • 举报
回复
<body style="margin: 0px;" dir="ltr" onmouseup="return CM.mouseup();" onmousemove="return CM.mousemove(event);">
<form id="form1" runat="server">
<uc1:Header ID="Header" runat="server" />
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0" style="width: 1280px; height: 100%">
<tr>
<td align="left" id="colleft" style="width: 195px;">
<iframe frameborder="0" id="I1" name="I1" src="LeftTree.aspx" class="main_iframe"
allowtransparency="true"></iframe>
</td>
<td style="width: 1px; cursor: col-resize;" id="colmid" onmouseover="CM.mouseover(this)"
onmouseout="CM.mouseout(this)" onmousedown="return CM.mousedown(event)" onmouseup="return CM.mouseup();">
</td>
<td id="colright" style="height: 650px">
<iframe frameborder="0" id="I2" name="I2" scrolling="yes" src="DataShow.aspx" class="main_iframe">
</iframe>
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
GGGc_ 2012-08-07
  • 打赏
  • 举报
回复
<script type="text/javascript">
var _winWidth = 180;
var _winHeight = 575;
/*******************************/
/***** Colmid (CM) Object *****/
/*******************************/
function CM() { }
CM.mouseover = function(p_o) { p_o.style.backgroundColor = "#549FE3"; }
CM.mouseout = function(p_o) { p_o.style.backgroundColor = "#FFFFFF"; }
CM.mousedown = function(p_ev) {
p_ev = (p_ev) ? p_ev : event;
CM.ismousedown = true;
CM.currpos = p_ev.clientX;
CM.currLeftW = CM.getCurrLeftW();
document.body.style.cursor = 'col-resize';
return false;
}
CM.mouseup = function() {
CM.ismousedown = false;
document.body.style.cursor = 'auto';
CM.currLeftW = parseInt(document.getElementById("colleft").style.width);
return false;
}
CM.mousemove = function(p_ev) {
if (CM.ismousedown) {
p_ev = (p_ev) ? p_ev : event;
var newpos = p_ev.clientX;
var pxmoved = parseInt(newpos - CM.currpos);
pxmoved = (document.body.dir == 'rtl') ? -pxmoved : pxmoved;
var newLeftW = parseInt(CM.currLeftW + pxmoved);
var newRightW = getWinWidth() - newLeftW - CM.rightWAdj;
if (newLeftW >= CM.minLeft && newRightW >= CM.minRight) {
document.getElementById("colleft").style.width = newLeftW + 'px';
}
return false
} else return true;
}
CM.setMinLeft = function() {
CM.minLeft = 1;
}
CM.getCurrRightW = function() {
return getWinWidth() - CM.getCurrLeftW() - CM.rightWAdj;
}
CM.getCurrLeftW = function() {
if (CM.currLeftW == 0) CM.currLeftW = parseInt(document.getElementById("colleft").style.width);
return CM.currLeftW;
}
CM.ismousedown;
CM.currpos;
CM.currLeftW = 0;
CM.minLeft;
CM.minRight = 920;
CM.rightWAdj = 21; //8+8+5
/***** End Colmid (CM) Object *****/

function getElemHeight(p_el) {
if (p_el.innerHeight) return p_el.innerHeight;
else if (p_el.clientHeight) return p_el.clientHeight;
else return p_el.offsetHeight;
}
function getWinHeight() {
if (window.innerHeight) return window.innerHeight;
else if (document.documentElement.clientHeight) return document.documentElement.clientHeight;
else if (document.body.offsetHeight) return document.body.offsetHeight;
else return _winHeight;
}
function getWinWidth() {
if (window.innerWidth) return window.innerWidth;
else if (document.documentElement.clientWidth) return document.documentElement.clientWidth;
else if (document.body.offsetWidth) return document.body.offsetWidth;
else return _winWidth;
}
function HandleOnLoad() {
CM.setMinLeft();
}
/***** Attach events *****/
window.onload = HandleOnLoad;

/*
function hiddenOrDisplayLeft() {
if (document.getElementById('Left').style.display == "none") {
document.getElementById('Left').style.display = 'block';
document.getElementById('hiddenImg').src = "../../img/btn_right_img.gif";
} else {
document.getElementById('Left').style.display = 'none';
document.getElementById('hiddenImg').src = "../../img/btn_left_img.gif";
}
}
*/
$(function() {
$("#Header_list_LegClassLabel").addClass("BGColor");
})
</script>

87,926

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧