开发者

How to fade in / out background music in HTML ( no Flash )?

开发者 https://www.devze.com 2023-02-21 10:42 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号