[問題] JS控制網頁上的浮動視窗
小弟本身不會寫JS只會改改別人簡單的成品
我看到一個浮動視窗的JS想要應用一下,但是該JS只有控制一只示窗
我想把它改成左右雙邊視窗
如圖
http://ppt.cc/vgg_
原始的程式如下
<SCRIPT type=text/javascript>
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
lastScrollY=0;
function rollimg(){
var varY = document.body.scrollTop;
if (varY <= 0)
{
varY = document.documentElement.scrollTop;
}
percent=.1*(varY-lastScrollY);
if(percent >0 )
percent=Math.ceil(percent);
else
percent=Math.floor(percent);
var top = parseInt(document.getElementById("floatlayer").style.top);
document.getElementById("floatlayer").style.top = (top += percent) + "px";
lastScrollY += percent;
document.getElementById("floatlayer").style.left=(document.body.clientWidth/2+405)+"px";
}
window.setInterval("rollimg()",1);
//-->
</SCRIPT>
<DIV style="POSITION: absolute; TOP: 70px; right:-100px; height: 405px;"
id="floatlayer">
<STYLE type=text/css>
#msn_box {
PADDING:0; MARGIN: 0px;width:89px;height:405px;
}
</STYLE>
<iframe src="/eweb_ta8989/html/go_idx.html" allowtransparency="true"
style="background-color=transparent" title="線上客服" frameborder="0"
width="168" height="405" scrolling="No"></iframe></DIV>
<script language="javascript">
function reSize(){
parent.document.all.getElementsByTagName("iframe").height=document.body.scrollHeight;
}
window.onload=reSize;
</script>
如果我要在左邊再加入一個 floatlayer1
請問我JS的部分該怎麼寫才能控制floatlayer1的位置會隨著頁面捲動也跟著floatlayer
位移一樣的px
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.128.137.46
※ 編輯: zeroex2100 來自: 220.128.137.46 (04/30 17:42)