html设置浮动框架的位置,HTML 浮动框 大体框架

这篇博客详细介绍了如何使用JavaScript实现网页上的动态面板展开和关闭功能。通过`initFudong`函数初始化面板尺寸和位置,`openOrClosePanel`用于切换面板状态,`closePanel`和`openPanel1`分别用于隐藏和显示面板。文章重点讨论了适配宽度的逻辑以及相关样式调整,适合前端开发者学习和参考。
摘要由CSDN通过智能技术生成

//ID

//=================================================================

//初始化

function initFudong(){

document.getElementById("fudongDIVid").style.width=250;

document.getElementById("fudongDIVid").style.height=500;

document.getElementById("fudongDIVid").style.display="";

document.getElementById("fudongDIVid").style.top=topTableHeight;

document.getElementById("fudongDIVid").style.left= parseInt(document.body.clientWidth)-parseInt(document.getElementById("fudongDIVid").style.width);

document.getElementById("fudongDIVid").style.height= parseInt(document.body.clientHeight)-topTableHeight-bottomHeight-5;

}

var currentOpentObj=270;

var toWidthjian=0;

//适宽

function inittabpanelWidth(toobj1,obj2){

if(parseInt(obj2.style.width)>270) {       //fudongDIVid

// alert(toobj1+"  "+obj2);

toobj1.style.width=parseInt(obj2.style.width);

toobj1.style.left=parseInt(document.body.clientWidth)-parseInt(toobj1.style.width)-toWidthjian;

currentOpentObj=parseInt(toobj1.style.width)+10;

//currentOpentObj=parseInt(obj2.style.width);

//toobj1.style.height=obj2.style.height;

}else{

currentOpentObj=270;

document.getElementById("fudongDIVid").style.left= parseInt(document.body.clientWidth)-currentOpentObj;

toobj1.style.width=currentOpentObj;

document.getElementById("fudongDIVid").style.width=currentOpentObj;

}

document.getElementById("IMGID").src="images/tabpanle/close.gif";

}

//展开

function openOrClosePanel(objimg){

if(objimg.src.indexOf("close")!=-1){

document.getElementById("fudongDIVid").style.left= parseInt(document.body.clientWidth)-15;

document.getElementById("fudongDIVid").style.width=13;

objimg.src="images/tabpanle/open.gif";

}else{

document.getElementById("fudongDIVid").style.left= parseInt(document.body.clientWidth)-currentOpentObj-toWidthjian;

document.getElementById("fudongDIVid").style.width=currentOpentObj;

objimg.src="images/tabpanle/close.gif";

}

}

//隐藏

function closePanel(){

document.getElementById("fudongDIVid").style.left= parseInt(document.body.clientWidth)-15;

document.getElementById("fudongDIVid").style.width=13;

document.getElementById("IMGID").src="images/tabpanle/open.gif";

//document.getElementById("IMGID").src="images/tabpanle/close.gif";

}

//打开

function openPanel1(){

document.getElementById("fudongDIVid").style.left= parseInt(document.body.clientWidth)-currentOpentObj-toWidthjian;

document.getElementById("fudongDIVid").style.width=currentOpentObj;

document.getElementById("IMGID").src="images/tabpanle/close.gif";

}

//插入内容

sss

可能需要简单的修改。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值