quocbao
07-03-2005, 03:09 AM
Hi
I have a problem during creating a floating bar . It will move when you scroll .
I use onscroll event . But when i use it in punBB board , it doesn't move when i scroll (i use this forum http://punbb.org/forum)
here the code
<script language=javascript>
if (typeof(__LOAD__) == 'undefined')
{
__LOAD__ = true;
__SMILEBOX__();
}
function __SMILEBOX__()
{
//render image
this.render = function()
{
html = "";
return html;
}
//add div object
__DIV__ = document.createElement('DIV');
__DIV__.style.position = "absolute";
__DIV__.style.left = document.body.scrollLeft + 15;
__DIV__.style.top = document.body.scrollTop + 20;
__DIV__.style.width = "150px";
__DIV__.style.height = "200px";
__DIV__.style.filter = "alpha(opacity=50); -moz-opacity: 0.5;";
__DIV__.style.border = "1px solid black";
__DIV__.style.background = "#FFFFFF";
__DIV__.style.zIndex = "9999";
__DIV__.innerHTML = this.render();
document.body.appendChild(__DIV__);
this.__DIV__ = __DIV__;
this.__SCROLL__ = window.onscroll;
this.doscroll = function()
{
if (this.__SCROLL__) this.__SCROLL__();
this.__DIV__.style.top = document.body.scrollTop + 20;
this.__DIV__.style.left = document.body.scrollLeft + 15;
}
window.onscroll = this.doscroll;
}
</script>
I have a problem during creating a floating bar . It will move when you scroll .
I use onscroll event . But when i use it in punBB board , it doesn't move when i scroll (i use this forum http://punbb.org/forum)
here the code
<script language=javascript>
if (typeof(__LOAD__) == 'undefined')
{
__LOAD__ = true;
__SMILEBOX__();
}
function __SMILEBOX__()
{
//render image
this.render = function()
{
html = "";
return html;
}
//add div object
__DIV__ = document.createElement('DIV');
__DIV__.style.position = "absolute";
__DIV__.style.left = document.body.scrollLeft + 15;
__DIV__.style.top = document.body.scrollTop + 20;
__DIV__.style.width = "150px";
__DIV__.style.height = "200px";
__DIV__.style.filter = "alpha(opacity=50); -moz-opacity: 0.5;";
__DIV__.style.border = "1px solid black";
__DIV__.style.background = "#FFFFFF";
__DIV__.style.zIndex = "9999";
__DIV__.innerHTML = this.render();
document.body.appendChild(__DIV__);
this.__DIV__ = __DIV__;
this.__SCROLL__ = window.onscroll;
this.doscroll = function()
{
if (this.__SCROLL__) this.__SCROLL__();
this.__DIV__.style.top = document.body.scrollTop + 20;
this.__DIV__.style.left = document.body.scrollLeft + 15;
}
window.onscroll = this.doscroll;
}
</script>