Fade in audio

$(document).ready(function(){ var backAudio = $('#background_audio'); var muted = false; $('#mute').click(function(){ var button = $(this); if (!muted) { button.attr("disabled", ""); backAudio.animate({volume: 0}, 1000, function () { muted = true; button.removeAttr("disabled", ""); button.text("Unmute sound"); }); } else { button.attr("disabled", ""); backAudio.animate({volume: 1}, 1000, function () { muted = false; button.removeAttr("disabled", ""); button.text("Mute sound"); }); } }); });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.