Results 1 to 2 of 2

Thread: Stop activity from a previous rollover by hovering over another?

  1. #1
    Join Date
    Sep 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Stop activity from a previous rollover by hovering over another?

    I have a code of an image that will play a .wav file when you hover over it. I would like the file to keep playing even while your mouse is not hovering over it until you decide to hover over another one.

    Here is my code:
    <a href="bigpic.jpg" ONMOUSEOVER="OnImage('pic1');javascript:jsPlay('thewav');return true;" ONMOUSEOUT="OffImage('pic1');javascript:jsStop('thewav');return true;"><img src="thumbnail.jpg" name="pic1" border="0" id="pic1"></a>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Obviously then, you cannot have the red part:

    Code:
    <a href="bigpic.jpg"
    ONMOUSEOVER="OnImage('pic1');javascript:jsPlay('thewav');return true;"
    ONMOUSEOUT="OffImage('pic1');javascript:jsStop('thewav');return true;"><img src="thumbnail.jpg" name="pic1" border="0" id="pic1"></a>
    I think that you would also need to set something to let the page know that the thing was playing, so it could be stopped if, and only if it is already playing, and OH! - you really don't need javascript: in this type of syntax (addition green):

    Code:
    <a href="pic.jpg"
    onmouseover="OnImage('pic1');jsPlay('thewav');this.onmouseover.on=true;return true;"
    onmouseout="OffImage('pic1');return true;"><img src="thumbnail.jpg" name="pic1" border="0" id="pic1"></a>
    Now we are ready to cancel play of 'thewav' onmouseover of any other image:

    Code:
    <a href="anotherpic.jpg"
    onmouseover="if(document.images.pic1.parentNode.onmouseover.on){document.images.pic1.parentNode.onmouseover.on=false;jsStop('thewav')};OnImage('pic2');jsPlay('theotherwav');this.onmouseover.on=true;return true;"
    onmouseout="OffImage('pic2');return true;"><img src="thumbnail.jpg" name="pic2" border="0" id="pic2"></a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •