Forum Moderators: not2easy

Message Too Old, No Replies

a: hover with Sound WITHOUT using JavaScript

playing sound on a:hover using only .css

         

elliekat

2:47 pm on Apr 7, 2004 (gmt 0)

10+ Year Member



I am starting to suspect this is impossible: I want a sound to play when a link is hovered over, but I don't want to use a javascript event to do it (i.e., onMouseover).

I have searched the W3C site and it looks like I won't be able to do it - I was hoping that I trigger the sound on a:hover just like you can change the text color or background image.

Does anyone know how to do this? Much appreciated.

Ellen

Bonusbana

3:32 pm on Apr 7, 2004 (gmt 0)

10+ Year Member



Im almost sure its not possible in html/css. If its an important feature of your design, you might consider using flash instead.

DrDoc

7:36 pm on Apr 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to Webmaster World!

1) it is not possible
2) why would you want to do it without JavaScript, when that works perfectly fine?

No need to reinvent the wheel ;)

mach

9:04 pm on Apr 7, 2004 (gmt 0)

10+ Year Member



Consider using flash. Also, reconsider if you really want to use sound. Although sound can be a nice touch, it can also be very annoying.

Rambo Tribble

9:13 pm on Apr 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, the CSS 2 specification does include aural styles such as azmuth and the various cue properties. It's just that browsers don't support them yet.

DrDoc

11:20 pm on Apr 7, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Aural styles are not meant for regular screen browsers.

encyclo

12:11 am on Apr 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



CSS is for styling, and it is not a programming language. It's trying to build a bridge with cake - it's just not the right substance. Javascript is the right and only appropriate tool for this.

As DrDoc says, aural stylesheets (which are a terrible idea and aren't supported anywhere anyway) are for when a web page is read by a screen reader rather than displayed on a screen.

Rambo Tribble

12:22 am on Apr 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, the aural styles include the feature of background sounds or music, not just reading of text. And while it has now been repetitively pointed out that browsers don't support aural styles, projects are under way to provide that support.

zaptd

6:30 am on Apr 8, 2004 (gmt 0)

10+ Year Member



Aural styles will be deprecated in CSS 2.1:

[w3.org...]

HTH,
CK

DrDoc

2:38 pm on Apr 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



the aural styles include the feature of background sounds or music

...still not intended for the normal user.

[w3.org...]

speech
Intended for speech synthesizers. Note: CSS2 had a similar media type called 'aural' for this purpose. See the appendix on aural style sheets for details.

...

Media types are mutually exclusive in the sense that a user agent can only support one media type when rendering a document. However, user agents may have different modes which support different media types.

So, a browser cannot support both the speech (aural) and screen media type at the same time. Several browsers have this problem today with print style sheets, but that's not the way it is supposed to be.

Aural styles will be deprecated in CSS 2.1

Aural styles are not deprecated... The media type is, and replaced by speech. But that's merely a matter of name change.

elliekat

3:09 pm on Apr 8, 2004 (gmt 0)

10+ Year Member



Thanks for the feedback..I was pretty sure I couldn't do it but I had to check! I actually have implemented this functionality with javascript, but there's the slightest delay between mousing over a link and the tone sounding (even when I preload the sound). This wasn't acceptable for what we were trying to do, so I had to check and see if there was a better way. Thanks all.

Ellen

Rambo Tribble

3:31 pm on Apr 8, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



My mistake. So I guess, then, those wishing to listen to a web page's content while they drove would be "abnormal users"? (Not that I condone any further distraction of drivers)

zaptd

4:39 pm on Apr 8, 2004 (gmt 0)

10+ Year Member



Aural styles are not deprecated... The media type is, and replaced by speech. But that's merely a matter of name change.

Thanks DrDoc. I guess a better word for aural styles will be “undefined” when CSS 2.1 becomes a formal recommendation.

Therefore CSS 2.1 reserves the 'speech' media type (see chapter 7, "Media types"), but does not yet define which properties do or do not apply to it.

The W3C has reserved the media type speech, but the properties and values for this new media type are completely undefined. Aural styles will still be valid in CSS 2.1, but they will have no defined meaning.

HTH,
CK