Is there a way to fade in / out background music using a JavaScript event in HTML co开发者_运维知识库des ? I need to support both modern browsers and iPhone / iPad's MobileSafari.
Most modern browsers support HTML5, and HTML5 lets you adjust the volume on an audio element (http://www.w3.org/TR/html5/video.html#dom-media-volume). You could use a JavaScript setTimeout to progressively lower the volume of a playing track until volume=0.
精彩评论