stop onmouseover resume onmouseout

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Greg A

    #1

    stop onmouseover resume onmouseout

    Hi:

    What can I add to this script to make it stop scrolling onmouseover, and
    resume onmouseout?

    Thanks.


    <script language="JavaS cript">
    function getObject( obj ) {
    var strObj
    if ( document.all ) {
    strObj = document.all.it em( obj );
    } else if ( document.getEle mentById ) {
    strObj = document.getEle mentById( obj );
    }
    return strObj;
    }
    var theTop = 20;
    var theHeight = 100;
    var theWidth = 150;
    var theLeft = 650;
    var toClip = 55;

    function scrollNews( newsDiv, toMove ) {
    theDiv = getObject( newsDiv.toStrin g() );
    if ( theDiv == null ) { return; }
    if ( document.layers ) {
    theDiv.clip.top = toMove;
    theDiv.clip.bot tom = toMove + toClip;
    theDiv.top = theTop - toMove;
    } else {
    theDiv = theDiv.style;
    theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " +
    (toMove + toClip) + "px 0px)";
    theDiv.top = theTop - toMove + 'px';
    }
    if ( ( theTop + theHeight - toMove ) < ( theTop - theHeight - 20 ) ) {
    toMove = 0;
    if ( document.layers ) {
    theDiv.clip.top = theTop;
    theDiv.clip.bot tom = toClip;
    theDiv.top = theTop
    } else {
    theDiv.clip = "rect(" + toMove + "px " + (theWidth + theLeft) + "px " +
    (toMove + toClip) + "px 0px)";
    theDiv.top = theTop + 'px';
    }
    }
    toMove = (toMove + 1);
    setTimeout("scr ollNews('" + newsDiv + "'," + toMove + ")", 100);
    }
    </script>


  • Randy Webb

    #2
    Re: stop onmouseover resume onmouseout

    Greg A wrote:
    [color=blue]
    > Hi:
    >
    > What can I add to this script to make it stop scrolling onmouseover, and
    > resume onmouseout?[/color]

    Add an onmouseover and onmouseout event handler that will clear the
    timeout and restart it.
    [color=blue]
    > setTimeout("scr ollNews('" + newsDiv + "'," + toMove + ")", 100);[/color]

    myTimer = setTimeout(.... ......)

    onmouseover = clearTimeout(my Timer)
    onmouseout = functionNameTha tSetsTheTimerAg ain();

    Give it a try and post back

    --
    Randy

    Comment

    Working...