Tech Off Thread

5 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Reset a <marquee> with Javascript?

Back to Forum: Tech Off
  • User profile image
    jsampsonPC

    Is it possible to reset the position of all the text within a <marquee> programmatically with Javascript?

    I have a marquee (width id='marquee1'). In it, I have the text "Hello World". The scroll amount is set to 0, and the scroll delay is set to 50. In the style attribute of the marquee I have display: none; to hide it on load.

    I have an image, and on the image I have a javascript function attached to the onMouseOver. That function does the following...

    var myMarquee = document.getElementById("marquee1");
    myMarquee.style.display = '';
    myMarquee.scrollAmount = 3;


    I have another function for the onMouseOut...

    var myMarquee = document.getElementById("marquee1");
    myMarquee.style.display = 'none';
    myMarquee.scrollAmount = 0;

    So when the page loads, the marquee is populated with text, and it is hidden, via css. When the client image event 'onMouseOver' is invoked, the marquee displays itself and begins scrolling. When the client image event 'onMouseOut' is invoked, the scrolling stops and the marquee is returned to its hidden state.

    I'm wondering if it's possible to not only hide the marquee, but return it's scroll-position back to its initial state...

  • User profile image
    AdamKinney

    <marquee>?  Hmm...

    This is one of the reasons people are favoring Javascript solutions to the marquee element.  Maybe you could try resetting the Loop attribute?  Set it to 0 on hide so it stops and then set it to -1 when its displayed for infinite play.

  • User profile image
    Ang3lFir3

    As a potential other option.... and because IIRC you might be interested in implementing some atlas controls, you might want to take a look at:

    http://atlas.asp.net/atlastoolkit/Animation/Animation.aspx

    this could easily accomplish the task you are after and then some.

  • User profile image
    jsampsonPC

    Thanks, guys.

    I'm installing the atlas controls as we speak. I am curious, are all of these controls functional in all of the major browsers?

    Jonathan

  • User profile image
    Ang3lFir3

    jsampsonPC wrote:
    

    Thanks, guys.

    I'm installing the atlas controls as we speak. I am curious, are all of these controls functional in all of the major browsers?

    Jonathan



    one of the important parts of Atlas is that the controls have cross-platform support. That said, they SHOULD be.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.