Hi,
Perhaps this is not an important feature, I don't expect this will be implemented but please, if you could help memake this, I will be happy.
Since my website is visited by lots of visual impaired people, it will be great if when the user clicks and open or close a menu, a little wav sound will be played, one for open and one for closed.

I'd like to know if it is possible and if yes, what sort of code should I insert into javascripts or module?
thanks in advance.

Comments

cburschka’s picture

Version: 5.x-1.4 » 6.x-2.x-dev
Status: Active » Postponed

The D5 version will not receive any new features; only D6 will.

Firstly, I'm a bit dubious about using this Javascript visual stuff on a site for disabled users, because it is difficult for screen-readers and Braille displays to cope with it.

You can add this with Javascript in a specific theme, without having to modify the module code. Unfortunately playing sounds in Javascript is not something I'm familiar with.

drein’s picture

well,
it's quite true, anyway screen readers are able to manage well this java scripts. I can say this because I'm visual impaired too, and I have no problems using open/close menus.
Anyway, I don't want to upgrade to d6, due to some modules that I'm using that are not upgraded now, so I think to attempt to using some theme capability or modify the javascript, now I'll see.
Thanks anyway.

cburschka’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
Assigned: Unassigned » cburschka

There is a jQuery sound plugin.

http://dev.jquery.com/view/trunk/plugins/sound/

cburschka’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev

This will land in D7 first and might be backported later.

cburschka’s picture

Title: Play a sound when menu open/close? » Allow extensible behaviors when opening/closing menus
Status: Postponed » Active

I've thought about this a few times and determined that the sound plugin of jQuery is so much extra code to include with DHTML menu that this feature won't make it into the "core" module. However, the module could well use a behaviors object (the same way Drupal has Drupal.behaviors) to bind custom actions to the two main DHTML events, opening and closing menus. This would involve perhaps 4-5 extra lines of Javascript in dhtml_menu.js that would be ignored if the extension is not used.

To extend, you would just need a custom JS file doing something like

Drupal.dhtmlMenu.events.myModule = {
  open:function(li) { plaSound(); }
};
johnpitcairn’s picture

Yes! This would be most useful, especially if back-ported to Drupal 6.

I'm currently looking at overriding Drupal.dhtmlMenu.toggleMenu, because unfortunately the slide effect also manipulates opacity. jQuery uses a filter to do this for IE 6 & 7, which turns text antialiasing off when the menu slides down. Not good - I need remove the opacity change, but keep the slide.

It would be more maintainable to roll my own jQuery behaviour and attach that, instead of overriding the entire function.

drein’s picture

Ah, that's seems interesting!
I upgraded to drupal6, I'll make some test with java codes you provide.
Thanks.

cburschka’s picture

In 7.x-1.0 and 6.x-4.0, the animation effects (opacity, etc.) can be picked in the UI anyway, so there is no need to write any Javascript.