SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Play sound OnMouseover

    Please help, I have a page with 3 images. I want my visitors to hear an mp3 audio once they hover their mouse on each image.
    image1 = audio1.mp3
    image2 = audio2.mp3
    image3 = audio3.mp3

    But here are the challenges.
    1- I want the audio files to play on the same page where the images are, without opening a new page.
    2- I don't want the users to be asked to accept any kind of plugins (such as Windows Media Player). Which means everything needed to run the script should already exist on that page.
    3- I want it to be played on the 3 major browsers (IE, Firefox, Chrome)

    Is this possible? I'm not good at Javascript, but I will understand to do my best to understand your instructions.

    I spent a long time looking online, but most of what I found is only compatible in one browser or the other. Any help would be appreciated.

  2. #2
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    1 and 3 are 100% possible but number 2 without a hidden flash player of some sort is not possible to avoid without having a plugin popup appearing.

    However if you find a nice flash player that can be hidden behind an element the easiest way to embed flash dynamically is to use the swfobject library

    http://code.google.com/p/swfobject/
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  3. #3
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes I don't mind having some hidden file supporting the script. I just don't want my visitors to be asked to download a file to be able to hear the sound. Do you know any script that would do that?

  4. #4
    SitePoint Wizard bronze trophy chris.upjohn's Avatar
    Join Date
    Apr 2010
    Location
    Melbourne, AU
    Posts
    2,183
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Here is one that i found that's pretty easy to work with

    http://www.strangecube.com/audioplay/
    Blog/Portfolio | Evolution Xtreme | DFG Design | DFG Hosting | CSS-Tricks | Stack Overflow | Paul Irish
    Having lame problems with your code? Let us help by using a jsFiddle

  5. #5
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks I checked the website it looks perfect for what I need, except that I want the sound to be played when the person hovers the mouse on the image and not when they click. Can the script on the page you mentioned be changed to onmouse hovering?

    Quote Originally Posted by SgtLegend View Post
    Here is one that i found that's pretty easy to work with

    http://www.strangecube.com/audioplay/

  6. #6
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,631
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Here is what I found that worked for me. http://www.visibilityinherit.com/cod...mouse-over.php

  7. #7
    SitePoint Member
    Join Date
    Aug 2010
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the link, it looks great, I just don't know how to use it for 3 images. Because the code for this one seems to be made to deal with only one image and one sound. Any way this can be modified to be used with three images and three sounds?

    Quote Originally Posted by EricWatson View Post
    Here is what I found that worked for me. http://www.visibilityinherit.com/cod...mouse-over.php

  8. #8
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,631
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Yeah I wouldn't know either. Maybe just times everything by 3 (the essentials at least). I'm sure some others can offer a better solution to that though.


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
  •