Comment 237 for bug 125970

Revision history for this message
In , Eugene Miller (theerm) wrote :

This is a lousy fix, but it works.

When you move the mouse wheel, it hides the fixed div, so you can scroll, and then after a second of no movement, it'll show it again. I don't use the up/down arrows to scroll the page, so I didn't include an "onkeydown" window event, but it wouldn't be that hard to implement.

<style>
  #fixedDivId {
    position:fixed;
    right:0px;
    bottom:0px;
    border: 1px solid #000;
    background: #FFF;
  }

</style>

<div id="fixedDivId">I'm fixed.</div>

<script type="text/javascript"><!--

var hideTimer = false;
window.addEventListener('DOMMouseScroll', hideFixedDiv, false);

function hideFixedDiv(e){
 document.getElementById('fixedDivId').style.display = 'none';
 if (hideTimer) {
  clearTimeout ( hideTimer );
 }
 hideTimer = window.setTimeout("document.getElementById('fixedDivId').style.display = ''; hideTimer = false;", 1000);
}

//-->
</script>

---- Same thing only in jquery, and using a class.

<style>
  ,fixed {
    position:fixed;
    right:0px;
    bottom:0px;
    border: 1px solid #000;
    background: #FFF;
  }

</style>

<div class="fixed">I'm fixed.</div>

<script type="text/javascript"><!--

var hideTimer = false;
window.addEventListener('DOMMouseScroll', hideFixedClasses, false);

function hideFixedClasses(e){
 $('.fixed').css('display','none');
 if (hideTimer) {
  clearTimeout ( hideTimer );
 }
 hideTimer = window.setTimeout("$('.fixed').css('display',''); hideTimer = false;", 1000);
}

//-->
</script>