Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap

Q875 When using a floating layer, how do I keep the thing invisible when the user is scrolling the page and visible only when the user is not scrolling?

You are here: irt.org | FAQ | DHTML | Q875 [ previous next ]

Increase the setTimeout interval:

<script language="JavaScript"><!--
function pageOffset() {
    if (document.layers) {
        document.layers['parentLayer'].pageX = window.pageXOffset;
        document.layers['parentLayer'].pageY = window.pageYOffset;
    else if (document.all) {
        document.all['parentLayer'].style.left = document.body.scrollLeft;
        document.all['parentLayer'].style.top = document.body.scrollTop;
    setTimeout('pageOffset()',2000); // every 2 seconds

<body onLoad="pageOffset()">

<div id="layerName" left="10" TOP="10">Some content in here</div>


©2018 Martin Webb